• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Common superclass to all entities in EJB3.0

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want all my entities to contains fields that hold when they are last modified and by wath user. i created a superclass called BaseEntity that implements these properties and als holds the id because all other entities in the project will inherit from this base class.

i use TABLE_PER_CLASS as inheritence strategy. i'm having trouble with the id assignment for my entities.. when i use GeneratorType.AUTO (as i did before) i get this error message :

Problem creating service jboss.j2ee:service=EJB3,module=support.par
org.hibernate.MappingException: Cannot use identity column key generation with <union-subclass> mapping for:

When i try GeneratorType.TABLE or GeneratorType.SEQUENCE, none of my entities get an id (they all have 0).

I also tried to implement this superclass as and EmbeddableSuperClass but as i need to hold a reference to a user (which is also an entity) i can't use an EmbeddableSuperclass because it can only hold basic types as attributes.

Anyone knows what the prolem could be? Or is there any other, better strategy to get these attributes into each entity in de system?

Thx a lot in advance
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic