File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed
ebean-core/src/main/java/io/ebeaninternal/server/deploy
querybean-generator/src/main/java/io/ebean/querybean/generator Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 11package io .ebeaninternal .server .deploy ;
22
3- import io .ebean .Query ;
43import io .ebean .SqlUpdate ;
54import io .ebean .Transaction ;
65import io .ebean .ValuePair ;
@@ -125,6 +124,10 @@ private void initialiseAssocOne(String embeddedPrefix) {
125124 // no imported or exported information
126125 } else if (!oneToOneExported ) {
127126 importedId = createImportedId (this , targetDescriptor , tableJoin );
127+ if (importedId == null ) {
128+ throw new PersistenceException ("Cannot find imported id for " + fullName () + " from " + targetDescriptor
129+ + ". If using native-image, possibly missing reflect-config for the Id property." );
130+ }
128131 if (importedId .isScalar ()) {
129132 // limit JoinColumn mapping to the @Id / primary key
130133 TableJoinColumn [] columns = tableJoin .columns ();
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ class ProcessingContext implements Constants {
6666 * Entity classes for the default database.
6767 */
6868 private final Set <String > dbEntities = new TreeSet <>();
69+ private final Set <String > dbMappedSuper = new TreeSet <>();
6970
7071 /**
7172 * Entity classes for non default databases.
@@ -104,6 +105,10 @@ TypeElement embeddableAnnotation() {
104105 return elementUtils .getTypeElement (EMBEDDABLE );
105106 }
106107
108+ TypeElement mappedSuperclassAnnotation () {
109+ return elementUtils .getTypeElement (MAPPED_SUPERCLASS );
110+ }
111+
107112 TypeElement converterAnnotation () {
108113 return elementUtils .getTypeElement (CONVERTER );
109114 }
@@ -565,4 +570,12 @@ Element asElement(TypeMirror mirror) {
565570 boolean isNameClash (String shortName ) {
566571 return propertyTypeMap .isNameClash (shortName );
567572 }
573+
574+ void addMappedSuper (String fullName ) {
575+ dbMappedSuper .add (fullName );
576+ }
577+
578+ Set <String > getMappedSuper () {
579+ return dbMappedSuper ;
580+ }
568581}
Original file line number Diff line number Diff line change @@ -75,9 +75,17 @@ private int processEntities(RoundEnvironment roundEnv) {
7575 generateQueryBeans (element );
7676 count ++;
7777 }
78+ for (Element element : roundEnv .getElementsAnnotatedWith (processingContext .mappedSuperclassAnnotation ())) {
79+ addMappedSuperclasses (element );
80+ }
7881 return count ;
7982 }
8083
84+ private void addMappedSuperclasses (Element element ) {
85+ String fullName = ((TypeElement )element ).getQualifiedName ().toString ();
86+ processingContext .addMappedSuper (fullName );
87+ }
88+
8189 private void processOthers (RoundEnvironment round ) {
8290 processOthers (round , processingContext .converterAnnotation ());
8391 processOthers (round , processingContext .componentAnnotation ());
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ private void writeNativeImageFile() {
8888 for (Set <String > value : processingContext .getOtherDbEntities ().values ()) {
8989 allEntities .addAll (value );
9090 }
91-
91+ allEntities . addAll ( processingContext . getMappedSuper ());
9292 if (!allEntities .isEmpty ()) {
9393 FileObject jfo = processingContext .createNativeImageWriter (factoryPackage + ".ebean-entity" );
9494 if (jfo != null ) {
You can’t perform that action at this time.
0 commit comments