[jboss-user] [EJB 3.0] - Re: Is Disciminator used in @OneToMany?

edvedafi do-not-reply at jboss.com
Thu Aug 10 16:21:42 EDT 2006


May be the problem isn't quite what I thought:

Once I added referencedColumnName="" to all of the JoinColumns I was able to eliminate this problem.  As well as an @WHERE(clause="type=A") annotation along with the JoinColumns it kindof works.

However now I am noticing that on a OneToMany relationship it is including the discriminator, but on the OneToOne it is not.  So if I make them both OneToMany relationships then everything is fine, but If I make Baccount a OneToOne it thorws an exceptions saying that more than one record has been returned.  However if I make it a set the size of the set is always one just like it should be.  

I have also tried building another Entity that has only One OneToOne with another table that has a discriminator, and I see the same problem.  

When I look at the query that Hibernate generates the SQL of the OneToMany it has type=A in the where clause, but on the OneToOne it does not have this as part of the where clause even though I have the @Where annotation.

Why can't I use @Where with a OneToOne relationship?



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964473#3964473

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964473



More information about the jboss-user mailing list