[jboss-user] [EJB 3.0] - MappedSuperClass propogation through multiple inheritance le

alistairblack do-not-reply at jboss.com
Fri Sep 19 09:46:22 EDT 2008


Hi,

I'm using JBOSS 4.2.2 and developing with Eclipse Ganymede against MySQL.

I've created several entity beans inheriting from an abstract class annotated with @MappedSuperclass.  This class (a) contains four columns, annotated appropriately, common to both beans below it for optimistic locking and audit purposes.  The first entity (b) extending this class utilises the joined inheritance strategy and below this class is yet another class (c).  My understanding of columns defined within a MappedSuperclass is that they would be included within classes (b) and (c), not just (b), so I've added the columns to both of the underlying tables within the database.  However when hibernate attempts to insert into the table behind entity (c) it doesn't include the four columns within the INSERT statement and two of these columns do not have default values, resulting in the INSERT failing.

Having seen this behaviour, and out of morbid curiosity, I then removed the four columns from the database table for table (c).  The Eclipse JPA validator complained, but I compiled and deployed regardless and  Hibernate/JBOSS was able to persist the rows in both tables (b) and (c).  

Please can someone confirm the expected behaviour for columns within a @MappedSuperclass when this class is extended by entities two (or more) levels deep as it appears that the Eclipse validation and behaviour of JBOSS/hibernate are conflicting?

Many thanks for your help in advance.

Alistair

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4177676#4177676

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4177676



More information about the jboss-user mailing list