Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » (no subject)
(no subject) [message #704323] Thu, 28 July 2011 13:28
Michal is currently offline MichalFriend
Messages: 5
Registered: July 2009
Junior Member
I am working on some project and have such situation:

I have Entity Service:

public class Service implements Serializable {
private Long id;
Collection<Language> language;

And entity Language:

public class Language implements Serializable {
private String id;

Thanks to it I have Entity Service which contains collection of available languages in DB it creates table: Service, Language and Service_Language for many to many mapping.

Now I want to add subscription entity:

public class Subscription implements Serializable {
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

private Service service;
private User user;

private Language language;

Now it creates table Subscription with service_id field which is foreign key to and field language_id which is foreign key to

OK but in this situation I can create subscription entity with some service id and language which is not on that service list.

I need one more foreign key contraint: foreign key (service_id,language_id) references Service_Language(service_id,language_id)

Ive tried some methods but it does not work and I cannot find anything in Google.

Maybe some of you can help me.

Previous Topic:Invalid column name problem
Next Topic:Addtional Foreign Key
Goto Forum:

Current Time: Mon Apr 12 22:10:33 GMT 2021

Powered by FUDForum. Page generated in 0.01463 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top