2017-03-10 8 views
0

Spring Tool Suite 3.8.3과 함께 Spring Roo 2 RC1을 사용하고 있습니다. MySQL 테이블의 내용을 나열하고 편집을 허용하는 프로젝트를 만들었습니다. 파인더를 제외한 모든 것이 작동합니다. 그들은 웹 애플 리케이션에 나타나지 않습니다. 내가 직접 그 부분을 구성해야하기 때문입니까? 아래는 내 log.roo 파일입니다. 다음과 같이 Spring Roo는 파인더 용 html 템플릿을 빌드합니까?

// Spring Roo 2.0.0.RC1 [rev 28015e3] log opened at 2017-03-07 14:07:55 
project setup --topLevelPackage org.oclc --projectName "sfdcIntegration" --java 8 --packaging JAR 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log closed at 2017-03-07 14:07:57 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log opened at 2017-03-07 14:08:00 
jpa setup --provider HIBERNATE --database MYSQL 
entity jpa --class ~.domain.SfdcAccount --table sfdc_account --identifierColumn account_id --identifierStrategy AUTO --sequenceName sequenceName --identifierType java.lang.Integer 
field string --fieldName sfdcRecordId --column sfdc_record_id --sizeMax 18 
field string --fieldName siebelRowId --column siebel_row_id --sizeMax 18 
field string --fieldName sfdcParentId --column sfdc_parent_id --sizeMax 18 
field string --fieldName siebelParentId --column siebel_parent_id --sizeMax 15 
field string --fieldName sfdcRecordTypeId --column sfdc_record_type_id --sizeMax 18 
field string --fieldName siebelRecordTypeId --column siebel_record_type_id --sizeMax 30 
field string --fieldName siebelResponsibleInstitutionName --column siebel_responsible_institution_name --sizeMax 15 
field string --fieldName responsibleInstitutionSymbol --column responsible_institution_symbol --sizeMax 40 
field string --fieldName billingStreet --column billing_street --sizeMax 255 
// [failed] field string --fieldName billingStreet --column billing_street --sizeMax 255 
field string --fieldName billingCity --column billing_city --sizeMax 40 
field string --fieldName billingState --column billing_state --sizeMax 80 
field string --fieldName billingPostalCode --column billing_postal_code --sizeMax 45 
field string --fieldName billingCountry --column billing_country --sizeMax 80 
field string --fieldName name --column name --sizeMax 255 
// [failed] field string --fieldName name --column name --sizeMax 255 
field string --fieldName fax --column fax --sizeMax 40 
field string --fieldName shippingStreet --column shipping_street --sizeMax 255 
field string --fieldName shippingCity --column shipping_city --sizeMax 40 
field string --fieldName shippingState --column shipping_state --sizeMax 80 
field string --fieldName shippingPostalCode --column shipping_postal_code --sizeMax 45 
field string --fieldName shippingCountry --column shipping_country --sizeMax 80 
field string --fieldName oclcAccountId --column oclc_account_id --sizeMax 50 
field string --fieldName oclcRegistryId --column oclc_registry_id --sizeMax 15 
field string --fieldName accountType --column account_type --sizeMax 40 
field string --fieldName dataCenter --column data_center --sizeMax 15 
field number --fieldName designatedVotingMember --type byte --column designated_voting_member 
exit 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log closed at 2017-03-07 14:28:15 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log opened at 2017-03-07 16:51:41 
field number --fieldName disableMailing --type byte --class ~.domain.SfdcAccount --column disable_mailings 
field number --fieldName oclcBoardOfTrustees --type byte --column oclc_board_of_trustees 
field number --fieldName apCouncilExecutiveCommittee --type byte --column ap_council_executive_committee 
field number --fieldName oclcGlobalCouncil --type byte --column oclc_global_council 
field number --fieldName oclcArcExecutiveCommittee --type byte --column oclc_arc_executive_committee 
field string --fieldName memberStatus --column member_status --sizeMax 30 
field string --fieldName accountStatus --column account_status --sizeMax 30 
field string --fieldName currencyIsoCode --column currency_iso_code --sizeMax 40 
field string --fieldName accountSubType --column account_sub_type --sizeMax 15 
field string --fieldName groupNumber --column group_number --sizeMax 22 
field string --fieldName groupType --column group_type --sizeMax 50 
field string --fieldName groupCode --column group_code --sizeMax 30 
field string --fieldName primaryLibraryType --column primary_library_type --sizeMax 100 
field string --fieldName secondaryLibraryType --column secondary_library_type --sizeMax 100 
field string --fieldName salesRep --column sales_rep --sizeMax 255 
field string --fieldName ownerName --column owner_name --sizeMax 255 
field number --fieldName sfdcAccountStatus --type java.lang.Long --column sfdc_account_status 
field number --fieldName sfdcLastUpdatedFlag --type byte --column sfdc_last_updated_flag 
field date --fieldName sfdcLastUpdatedDate --type java.util.Calendar --column sfdc_last_updated_date --persistenceType JPA_TIMESTAMP --dateTimeFormatPattern SS 
field number --fieldName siebelLastUpdatedFlag --type byte --column siebel_last_updated_flag 
field date --fieldName siebelLastUpdatedDate --type java.util.Calendar --column siebel_last_updated_date --persistenceType JPA_TIMESTAMP --dateTimeFormatPattern MM 
field string --fieldName lastUpdatedBy --column last_updated_by --sizeMax 45 
field date --fieldName lastUpdatedDate --type java.util.Calendar --column last_updated_date --persistenceType JPA_TIMESTAMP --dateTimeFormatPattern MM 
field string --fieldName sfdcResponsibleInstitutionName --column sfdc_responsible_institution_name --sizeMax 18 
field number --fieldName newRecordFlag --type byte --column new_record_flag 
field number --fieldName isDeleted --type byte --column isDeleted 
field number --fieldName loadId --type java.lang.Integer --column load_id 
field number --fieldName activeFlag --type byte --column active_flag 
field number --fieldName sfdcSent --type byte --column sfdc_sent 
field string --fieldName region --column region --sizeMax 45 
field number --fieldName relation --type byte --column relation 
field number --fieldName hasError --type byte --column has_error 
field number --fieldName siebelSent --type byte --column siebel_sent 
repository jpa --all 
finder add --entity ~.domain.SfdcAccount --name findByOclcAccountId 
finder add --entity ~.domain.SfdcAccount --name findBySfdcRecordId 
finder add --entity ~.domain.SfdcAccount --name findBySiebelRowId 
// [failed] finder add --entity ~.domain.SfdcAccount --name findByOclcSymbol 
field string --fieldName oclcSymbol --column oclc_symbol --sizeMax 12 
hint 
finder add --entity ~.domain.SfdcAccount --name findByOclcSymbol 
service --all 
web mvc setup 
web mvc view setup --type THYMELEAF 
web mvc templates setup --type THYMELEAF 
web mvc controller --entity ~.domain.SfdcAccount --responseType THYMELEAF 
web mvc finder --all --responseType THYMELEAF 
exit 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log closed at 2017-03-07 18:37:44 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log opened at 2017-03-08 13:38:19 
exit 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log closed at 2017-03-08 18:04:35 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log opened at 2017-03-09 09:35:01 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --package org.oclc.web --pathPrefix 'find' --queryMethod findBy --responseType THYMELEAF 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --package org.oclc.web --pathPrefix 'find' --queryMethod findBySiebelRowId --responseType THYMELEAF 
web mvc finder --all --responseType THYMELEAF --pathPrefix 'find' 
exit 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log closed at 2017-03-09 10:23:10 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log opened at 2017-03-09 12:06:44 
finder add --entity ~.domain.SfdcAccount --name findByOclcSymbolEqualsIgnoreCase 
hint 
web mvc finder --all --responseType THYMELEAF 
service --all 
web mvc templates setup --type THYMELEAF 
web mvc finder --entity ~.domain.SfdcAccount --responseType THYMELEAF 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --queryMethod findByOclcSymbolEqualsIgnoreCase 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --queryMethod findByOclcAccountId findByOclcSymbolEqualsIgnoreCase 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --queryMethod findByOclcAccountId 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --queryMethod findByOclcAccountId, findBySfdcRecordId, findBySiebelRowId, findByOclcSymbol, findByOclcSymbolEqualsIgnoreCase 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --queryMethod SfdcAccount.class 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --queryMethod SfdcAccount 
// [failed] web mvc finder --entity ~.domain.SfdcAccount --queryMethod findBy 
// Spring Roo 2.0.0.RC1 [rev 28015e3] log closed at 2017-03-09 18:39:52 

은 내가 DTO 양식 빈을 생성 :

dto --class ~.domain.SiebelRowIdFormBean 
field string --fieldName siebelRowId --sizeMax 18 
finder add --entity ~.domain.SfdcAccount --name findBySiebelRowIdEquals --formBean ~.domain.SiebelRowIdFormBean 

을하지만 난 그것을 게시 할 때 나는 Pathprefix를 제공해야합니다. pathPrefix가 무엇인지 알 수 없습니다. 이것은 내가 입력 한 것입니다 :

web mvc finder --entity ~.domain.SfdcAccount --responseType THYMELEAF --queryMethod findBySiebelRowIdEquals --package org.oclc.web --pathPrefix sfdcaccounts/search 

하지만이 오류 얻을 :

ERROR: Already exists a controller associated to entity 'SfdcAccount' in the same package 'org.oclc.web', with different 'pathPrefix'. Specify a different 'pathPrefix' and a different package that the existing one to create a new one, or the same 'package' and 'pathPrefix' to update the existing controller. 

나는 내가 "웹 MVC 찾기"명령을 통해 측정기를 재 구축하는 방법을 알아 냈다고 생각합니다. 웹 패키지 아래 검색 엔티티를 삭제했습니다. 그런 다음 "web mvc finder --all --responseType THYMELEAF"를 다시 입력했습니다. 봄 Roo는 나를 위해 파인더를 재생성했습니다.

답변

1

스프링 루 2.0.0.RC1은 스프링 데이터 저장소에 새로운 파인더를 생성하는 데 필요한 명령을 제공합니다. 작성한 후에는 웹 레이어에 게시하는 데 필요한 명령을 제공합니다.

그러나 모든 찾기가 웹 레이어에 게시하려면을 사용할 수있는 것은 아닙니다.

log.roo에서 볼 수 있듯이 모든 finder는 defaultReturnType 또는 DTO를 formBean으로 지정하지 않고 기본 스프링 데이터 명명법 findBy을 사용합니다. 확인할 수 있듯이 QueryDSL 구현을 사용하지 않기 때문에 인터페이스가 ~.repository.SfdcAccountRepository 인 경우에만 생성됩니다.

웹 계층에 게시 할 수있는 finder 메서드는 DataTables 구성 요소에서 올바르게 작동하려면 몇 가지 특정 매개 변수가 필요합니다. 따라서 다음과 같이 생성 된 파인더 만 게시 할 수 있습니다. 위의 그 후에 당신의 측정기의 일부의 FormBean으로 DTO를 사용하는

finder add --entity ~.domain.ENTITY --name findByFIELD --formBean ~.domain.DTO 

시도는 web mvc finder 명령을 사용하여 파인더를 게시 할 수 있습니다.

제대로 작동하는 것을 볼 수 있습니다!

아마도 Spring Roo 참조 가이드에서 이것이 분명하지 않을 수 있으므로 다음 작업을 검토했습니다. 봄 루의 프로젝트에 당신 공헌

https://jira.spring.io/browse/ROO-3903

감사합니다!

희망이 있습니다.

+0

DTO를 추가했지만 여전히 웹 MVC 찾기 명령이 작동하지 않습니다. 초기 질문에 더 많은 정보를 추가했습니다. –