Unable to Load Abstract Single Table Inheritance Entities After Upgrade to Play-Ebean 8.3.0 #3411
robby-macphail
started this conversation in
General
Replies: 1 comment 2 replies
-
You can NOT use Ebean 15.x and MUST use Ebean 14.x to use single table inheritance. Ebean 14.x and 15.x versions are aligned with bug fixes with the difference being that Ebean 15.x has some features removed and that includes removing support for single table inheritance. So you need to use ebean 14.x (and that version is maintained and 14.x is still the master branch). For background refer to: So change your dependency from |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Perhaps this question is better suited for a Play-Ebean discussion group, but I am upgrading a Java Play application to Play-Ebean 8.30 from 7.30, both of which, I believe, use the same Ebean version (15.1.0). The application has many abstract entity classes using single table inheritance strategy along with a discriminator. This pattern has worked well previously, but since the upgrade, Ebean is unable to load any of the entities inheriting the abstract class.
For example:
@entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "my_type_field", discriminatorType = DiscriminatorType.STRING)
public abstract class MyAbstractClass extends AnotherAbstractClass { ... }
@entity
@DiscriminatorValue("FOO")
public class MyConcreteClass extends MyAbstractClass { ... }
Attempting to load the entity results in:
Caused by: jakarta.persistence.PersistenceException: java.lang.UnsupportedOperationException: cannot create entity bean for abstract entity MyAbstractClass
at io.ebeaninternal.server.deploy.BeanDescriptor.createReference(BeanDescriptor.java:1521)
at io.ebeaninternal.server.deploy.BeanDescriptor.contextRef(BeanDescriptor.java:1730)
at io.ebeaninternal.server.deploy.AssocOneHelp.read(AssocOneHelp.java:70)
at io.ebeaninternal.server.deploy.AssocOneHelp.readSet(AssocOneHelp.java:81)
at io.ebeaninternal.server.deploy.BeanPropertyAssocOne.readSet(BeanPropertyAssocOne.java:624)
at io.ebeaninternal.server.query.SqlBeanLoad.load(SqlBeanLoad.java:63)
Has anything changed in recent Ebean versions to disallow using abstract classes with the single table inheritance?
Beta Was this translation helpful? Give feedback.
All reactions