-->
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: Creating Schema by identifying the Java Interfaces
PostPosted: Thu Feb 21, 2013 1:53 pm 
Newbie

Joined: Thu Feb 21, 2013 1:44 pm
Posts: 2
I want to create the schema from Java Objects. But while defining a collection field as a foreign key(ManyOne relation), i want to specify the interface as type of collection, not the implemented Class.

@Entity
public class Roles {

@Id
private long idRoles;
private String role;
@OneToMany
@JoinColumn(name="testID")
@ForeignKey(name="FK_Test_TestId")
private List<ITest> test

}

I have two implementation for ITest - TestA and TestB

How to make hibernate aware of which interface implementation to pick up


Top
 Profile  
 
 Post subject: Re: Creating Schema by identifying the Java Interfaces
PostPosted: Tue Feb 26, 2013 4:10 am 
Beginner
Beginner

Joined: Wed Feb 06, 2013 2:43 am
Posts: 46
I didn't get what is your problem here.
Specially this - I have two implementation for ITest - TestA and TestB
Can you please explain some more ?

And i use SET for a oneToMany join.
@OneToMany
@JoinColumn(name="testID")
@ForeignKey(name="FK_Test_TestId")
private Set<ITest> test {

}

_________________
Thanks,
Ajit Singh
ajits@mindfiresolutions.com
www.mindfiresolutions.com


Top
 Profile  
 
 Post subject: Re: Creating Schema by identifying the Java Interfaces
PostPosted: Tue Feb 26, 2013 1:40 pm 
Newbie

Joined: Thu Feb 21, 2013 1:44 pm
Posts: 2
Ajit Singh wrote:
I didn't get what is your problem here.
Specially this - I have two implementation for ITest - TestA and TestB
Can you please explain some more ?

And i use SET for a oneToMany join.
@OneToMany
@JoinColumn(name="testID")
@ForeignKey(name="FK_Test_TestId")
private Set<ITest> test {

}


Thanks Ajit for the response. Using List is my requirement. I can't use set. By ITest i meant Interface ITest. Though I think, its not possible in Hibernate to persist Interface implementations.


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.