This content has been marked as final.
Show 4 replies
-
1. Re: @EmbeddableSuperclass does not works as expected !
epbernard Jul 11, 2005 1:19 PM (in response to any_key)Hum, this is a limitation we have currently.
You need to explicitly list your embedded superclasses in your persistence.xml
FYI I fixed that in Hibernate Annotation HEAD a couple of days ago. -
2. Re: @EmbeddableSuperclass does not works as expected !
llucifer Jul 30, 2005 12:57 PM (in response to any_key)"epbernard" wrote:
You need to explicitly list your embedded superclasses in your persistence.xml
I'm using 4.0.3RC1 and have the same problem. I tried your tip but it fails. This is the persistence.xml I have:<entity-manager> <class>foo.EmbeddedSuperClass</class> </entity-manager>
Where EmbeddedSuperClass is@Embeddable @EmbeddableSuperclass public class EmbeddableSuperClass implements java.io.Serializable { ... }
and DerivedClass is@Entity @Inheritance(strategy=InheritanceType.JOINED) public class DerivedClass extends EmbeddableSuperClass implements Serializable{ ... }
But the properties derived from EmbeddableSuperClass are note created in the database. Is there a "conflict" because EmbeddableSuperClass is used as a @EmbeddableClass and a @Embeddable?
This kind of hierachy is driven by the following design. I have some global types which act as a default value and which are used as embedded instantec as well as in many-to-one relations. An example would be contract detail. In each order instance I have a reference to a "GlobalContractDetail" which is an instance of a ContractDetail and a used contract detail which store a snapshop of the GlobalContractDetail used a time of creation of the order. In my usecase I have a hierachie of ContractDetail. So the actual class model is:
@Embeddable, @EmbeddableSuperClass ContractDetail with basic properties.
@Entity GlobalContractDetail extends ContractDetail which adds a PK to ContractDetail
Order has a @many-to-one to GlobalContractDetali and a @embedded ContractDatail which stores the snapshot. -
3. Re: @EmbeddableSuperclass does not works as expected !
epbernard Aug 3, 2005 2:56 PM (in response to any_key)This is a known bug, will be fixed for the next release, I hope.
-
4. Re: @EmbeddableSuperclass does not works as expected !
goeh Aug 15, 2005 4:53 PM (in response to any_key)I could not get @EmbeddableSuperclass to work at all with 4.0.3RC1, but with 4.0.3RC2 things started to work. I use property access on my entities.
So from my point of view it is fixed in RC2.
This is how I use it.@EmbeddableSuperclass(access = AccessType.PROPERTY) public abstract class BasicEntity implements Serializable { private Long id = null; private int version = 0; @Id(generate = GeneratorType.AUTO) public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } @Version public int getVersion() { return this.version; } public void setVersion(int version) { this.version = version; } } @Entity(access = AccessType.PROPERTY) public class User extends BasicEntity { ... }