-->
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: @JoinColumn overrides scale and percision in ManyToOne map..
PostPosted: Thu Jun 05, 2008 9:14 am 
Newbie

Joined: Tue Mar 16, 2004 3:15 pm
Posts: 3
This is Hibernate 3.2.4 SP1 with Annotations version 3.2.1 (as supplied by JBoss AS 4.2.2)

Consider:

@Entity
p c Orders {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY, generator="java5_uuid")
@GenericGenerator(name="java_uuid", strategy="c.o.s.d.i.UUIDGenerator")
@Column(precision=128, scale=0)
private BigInteger id;

@OneToMany(mappedBy="order", cascade= ...)
@Fetch(FetchMode.SUBSELECT)
private Set<OrderLineItems> items;

}

@Entity
p c OrderLineItems {
...
@ManyToOne @JoinColumn(name="order_id")
Order order;

}

The only really important pieces are that a 128 bit integer is used for the key. This throws an exception on insert of a line item because the "precision" of the order_id is off. However if you remove the @JoinColumn then the error goes away and the generated column is 128 bit. You cannot have a @Column mapping on an @ManyToOne. In the XML format there is a way to specify the scale/precision of the key with the column element.

My questions -

1. is there a way to specify both the @JoinColumn AND the precision?
2. Why does @JoinColumn override the precision specified by the @Id that is obviously carried otherwise?
3. Is that a bug?
4. Can Gavin's fashion sense be blamed for this?

-Andy


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 4:53 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
3.
can you add a testcase for that in JIRA.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 4:55 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
And we can always blame Gavin's fashion taste, it never hurts :)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 10:47 pm 
Newbie

Joined: Tue Mar 16, 2004 3:15 pm
Posts: 3
http://opensource.atlassian.com/project ... se/ANN-748

done. Note that it doesn't replicate with Hypersonic.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 24, 2008 9:28 pm 
Newbie

Joined: Tue Mar 16, 2004 3:15 pm
Posts: 3
Note that the issue:
http://opensource.atlassian.com/project ... se/ANN-748 is now marked fixed. http://fisheye.labs.jboss.com/changelog ... e?cs=14760 and http://fisheye.labs.jboss.com/changelog ... e?cs=14761 are noted in jira as the fixes. I have a hacky fix that I put in our branch of H3A but Hardy's fix is simpler. I'll test this in our app next week.

Thanks to Emmanuel and Hardy Ferentschik.


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.