-->
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.  [ 5 posts ] 
Author Message
 Post subject: Important: Problems with Component Mapping
PostPosted: Thu Jul 19, 2007 10:24 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  
 
 Post subject:
PostPosted: Thu Jul 19, 2007 2:11 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't know exactly but for sure @Embeddable and @Entity on the same class is not supported today

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 6:29 am 
Beginner
Beginner

Joined: Wed Jul 18, 2007 6:13 am
Posts: 28
[quote="emmanuel"]I don't know exactly but for sure @Embeddable and @Entity on the same class is not supported today[/quote]

Thank you for your tip, but I don't think that it is the solution.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 9:47 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Well the tip shows that your mapping is not correct :)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 03, 2007 5:09 am 
Beginner
Beginner

Joined: Wed Jul 18, 2007 6:13 am
Posts: 28
[quote="emmanuel"]Well the tip shows that your mapping is not correct :)[/quote]

Well, but it works with @Entity and @Embedabble. He generates the table.

But I can't explain myself, why hibernate embeds the attribut if I leave out the ManyToOne-relation...

Nobody an Idea?


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

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.