Yeah, you are right. I think the primary key in this case is breaking a few
rules. I think one column in this case would be sufficient, but being an
application developer and not a database developer, what do I know. I will make
some effort to push back (if even possible). But for now I need to keep
trudging ahead.
So.... changing the mapping to @ManyToOne did not seem to have the desired
effect.
| State: FAILED
| Reason: org.hibernate.AnnotationException: A Foreign key refering
com.foo.entities.Type from com.foo.entities.Store has the wrong number of
column. should be 3
|
| @ManyToOne
| @JoinColumn(name="STORE_TYPE", referencedColumnName = "TYPE_ID")
| public Type getStoreType() {
| return storeType;
| }
|
You had multiple JoinColumns in your earlier post. But the STORE table doesn't
have a TABLE_NAME column in it. So how do I map that column of the TypePK class
to a static value? I would like to try something like the following, but I
don't think this will work the way it is.
| @ManyToOne
| @JoinColumn(name="STORE_TYPE", referencedColumnName = "TYPE_ID")
| @DiscriminatorColumn(name="TABLE_NAME",
discriminatorType=STRING,length=20)
| @DiscriminatorValue("STORE")
| @DiscriminatorColumn(name="FIELD_NAME",
discriminatorType=STRING,length=20)
| @DiscriminatorValue("STORE_TYPE")
| public Type getStoreType() {
| return storeType;
| }
|
But I believe @DiscriminatorColumn and @DiscriminatorValue are class level
annotations, not method level. Is that a correct assumption? If so, is there a
way to get the results of those annotations another way?
Thanks.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035098#4035098
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035098
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user