-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Annotations: Problem with Component Mapping
PostPosted: Fri Aug 03, 2007 6:45 am 
Beginner
Beginner

Joined: Wed Jul 18, 2007 6:13 am
Posts: 28
Hello

I search since 4 days for the following problems and I am really desperate :-(

Problem1:

I would like to embed the attributes "datum" and "datumszusatz" in the class "HFPersonImpl" from the class "ErweitertesDatumImpl". Hibernate override the Attribut "datum" but not "datumszusatz" (look at Example1).
If I don't use the Relationship, Hibernate generates the attribute "datumszusatz" (Example2). Why? Where is the mistake? Ist it a Hibernate bug?


EXAMPLE1
HFPersonImpl
...
@Embedded
@Target(de.ard.sad.trinidad.bo.ndb.impl.hibernate.basis.ErweitertesDatumImpl.class)
@AttributeOverrides( {
@AttributeOverride(name = "datum", column = @Column(name = "G_DAT_DATUM", columnDefinition = "VARCHAR2(20)")),
@AttributeOverride(name = "datumszusatz", column = @Column(name = "G_DAT_FK_DAT_ZUS_WERT", columnDefinition = "NUMBER(19)")) })
private ErweitertesDatum geburtsdatum;

@Embedded
@Target(de.ard.sad.trinidad.bo.ndb.impl.hibernate.basis.ErweitertesDatumImpl.class)
@AttributeOverrides( {
@AttributeOverride(name = "datum", column = @Column(name = "T_DAT_DATUM", columnDefinition = "VARCHAR2(20)")),
@AttributeOverride(name = "datumszusatz", column = @Column(name = "T_DAT_FK_DAT_ZUS_WERT", columnDefinition = "NUMBER(19)")) })
private ErweitertesDatum todesdatum;
...

ErweitertesDatumImpl
@Entity
@Table(name = "ERWEITERTES_DATUM")
@Embeddable
public class ErweitertesDatumImpl implements ErweitertesDatum, Serializable {
...
@Column(name = "DATUM", columnDefinition = "VARCHAR2(20)")
@Target(de.ard.sad.trinidad.bo.hibernate.dataTypes.DateIntervalUserType.class)
private DateInterval datum;

@ManyToOne(targetEntity = de.ard.sad.trinidad.bo.ndb.impl.hibernate.wert.DatumzusatzImpl.class)
@JoinColumn(name = "FK_DAT_ZUS_WERT", columnDefinition = "NUMBER(19)")
private Datumzusatz datumszusatz;
...

Result:

[hibernatetool] create table HF_PERSON (...G_DAT_DATUM VARCHAR2(20), T_DAT_DATUM VARCHAR2(20), FK_DAT_ZUS_WERT NUMBER(19)...


EXAMPLE2
HFPersonImpl
...
@Embedded
@Target(de.ard.sad.trinidad.bo.ndb.impl.hibernate.basis.ErweitertesDatumImpl.class)
@AttributeOverrides( {
@AttributeOverride(name = "datum", column = @Column(name = "G_DAT_DATUM", columnDefinition = "VARCHAR2(20)")),
@AttributeOverride(name = "datumszusatz", column = @Column(name = "G_DAT_FK_DAT_ZUS_WERT", columnDefinition = "NUMBER(19)")) })
private ErweitertesDatum geburtsdatum;

@Embedded
@Target(de.ard.sad.trinidad.bo.ndb.impl.hibernate.basis.ErweitertesDatumImpl.class)
@AttributeOverrides( {
@AttributeOverride(name = "datum", column = @Column(name = "T_DAT_DATUM", columnDefinition = "VARCHAR2(20)")),
@AttributeOverride(name = "datumszusatz", column = @Column(name = "T_DAT_FK_DAT_ZUS_WERT", columnDefinition = "NUMBER(19)")) })
private ErweitertesDatum todesdatum;
...

ErweitertesDatumImpl
@Entity
@Table(name = "ERWEITERTES_DATUM")
@Embeddable
public class ErweitertesDatumImpl implements ErweitertesDatum, Serializable {
...
@Column(name = "DATUM", columnDefinition = "VARCHAR2(20)")
@Target(de.ard.sad.trinidad.bo.hibernate.dataTypes.DateIntervalUserType.class)
private DateInterval datum;

@Target = (de.ard.sad.trinidad.bo.ndb.impl.hibernate.wert.DatumzusatzImpl.class)
private Datumzusatz datumszusatz;
...

Result:

[hibernatetool] create table HF_PERSON (...G_DAT_DATUM VARCHAR2(20), G_DAT_FK_DAT_ZUS_WERT NUMBER(19), descG_DAT_FK_DAT_ZUS_WERT NUMBER(19), T_DAT_DATUM VARCHAR2(20), T_DAT_FK_DAT_ZUS_WERT NUMBER(19), FK_DAT_ZUS_WERT NUMBER(19)...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.