-->
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.  [ 3 posts ] 
Author Message
 Post subject: "Invalid column name" with @Embeddable
PostPosted: Mon Mar 27, 2006 9:02 pm 
Newbie

Joined: Fri Apr 01, 2005 8:45 pm
Posts: 17
Sorry, I must be missing something basic with the @Embedded annotation... but I keep getting "Invalid column name" because the query only selects from 1 table. I have:

@Entity
class Foo implements Serializable
@id
Integer fooID;

@Embedded
Foo2 test;
}

@Embeddable
class Foo2 implements Serializable
@id
Integer fooID2;

String name;
}

And when I query for a list of Foo objects the SQL is:

select fooID, test, name from Foo

but the "name" column is only in the Foo2 table so we get a DB error. Appreciate if you can tell me where I went wrong. Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 27, 2006 9:34 pm 
Newbie

Joined: Wed Nov 26, 2003 4:41 pm
Posts: 12
Why do you think that should work?

Read http://www.hibernate.org/hib_docs/annot ... ssociation to understand what you should be doing.

cheers
dim


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 27, 2006 9:50 pm 
Newbie

Joined: Fri Apr 01, 2005 8:45 pm
Posts: 17
Thanks. I switched it to:

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name="test")

and it works fine. So, I take it Embedded was not right for this case.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.