Community
Participate
Working Groups
If you define a superclass which already defines @Id and related methods, the JPA Tools "Generate Entities from Tables..." wizard should not generate @Id and related methods in the new classes. Currently it does this: @Entity @Table(name="person") public class Person extends AbstractPersistable<Long> implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(unique=true, nullable=false) private int id; ... even though "AbstractPersistable" declares @Id with public accessor methods. The code generator should be smart enough to not write this overriding @Id, etc. Also, the code generator should give the user the option to either "import superclass package name" or "use fully qualified name for superclass". The former would generate an import statement, like this: ... import org.springframework.data.jpa.domain.AbstractPersistable; ... @Entity @Table(name="person") public class Person extends AbstractPersistable<Long> ... In the latter alternative, the code generator would behave as it does currently.
In case anyone comes across this same problem while waiting for its resolution, I'm adding to this report a bash script I wrote to massage the generated files. It assumes that you are using org.springframework.data.jpa.domain.AbstractPersistable as the superclass, and cleans up the fully qualified "extends" declaration, as well. See attachment.
Created attachment 228154 [details] Shell script to massage generated model files