-->
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: Question about one-to-one shared primary key
PostPosted: Thu Mar 10, 2011 5:56 pm 
Newbie

Joined: Thu Jun 01, 2006 2:15 am
Posts: 7
Hi Forum,

I'm having a issue with one-to-one shared primary key.

I have a UserAccount class like:
Code:
public class User implements Serializable {
   @Id
   @GeneratedValue(strategy = GenerationType.AUTO)
   @Column(name = "id")
   private Long id;
}


And UserForumProfile like:
Code:
@GenericGenerator(name = "userForumProfileGenerator", strategy = "foreign", parameters = @Parameter(name = "property", value = "owner"))
public class UserForumProfile implements Serializable {
   @Id
   @GeneratedValue(generator = "userForumProfileGenerator")
   @Column(name = "id")
   private Long id;

   @OneToOne
   @PrimaryKeyJoinColumn
   private User owner;
}


I don't want User refer back to UserForumProfile, so it's one way one-to-one.

The problem is:
If I issue query like:
select xxx, xxx, xxx from UserForumProfile ufp_ where ufp_.owner = ?
And assign User object as parameter, I keep getting positional parameter expecting: 1, actual User@xxxxxx

So I debugged into it and find it is passing only 1 parameter, however when it do "verifyParameters(false)" in AbstractQueryImpl, because one-to-one getColumnSpan always return 0, it consider as not match.

This is a bug? Or I defined my one-to-one mapping wrong?

Thanks for looking at it.

Noodle


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.