Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » [ SOLVED ]JPA Question
[ SOLVED ]JPA Question [message #1221891] Wed, 18 December 2013 16:21 Go to next message
Jack Kilian is currently offline Jack KilianFriend
Messages: 40
Registered: March 2012
Member
class ORDER {

@OneToMany
@JoinColumns({ @JoinColumn(name = "PARENT_ID", referencedColumnName = "ID"),
@JoinColumn(name = "TABLE_NAME", value="ORDER") })
private List<TableWithMultiKey> tableWithMultiKey;

}

I know that there is no "value" property...but something like this I need.

generated select should look like:

SELECT ID, FIELD1, FIELD2 FROM TableWithMultiKey WHERE PARENT_ID = 1 AND TABLE_NAME = 'ORDER';

...is it possible to implement a JoinColumn with a static value?

[Updated on: Thu, 02 January 2014 09:58]

Report message to a moderator

Re: JPA Question [message #1222017 is a reply to message #1221891] Thu, 19 December 2013 11:58 Go to previous messageGo to next message
Jack Kilian is currently offline Jack KilianFriend
Messages: 40
Registered: March 2012
Member
Is it possible to define a NamedQuery used by the @OneToMany call?
Re: JPA Question [message #1226649 is a reply to message #1222017] Thu, 02 January 2014 09:59 Go to previous message
Jack Kilian is currently offline Jack KilianFriend
Messages: 40
Registered: March 2012
Member
MySolution:

class ORDER {

@OneToMany
@JoinColumns({ @JoinColumn(name = "PARENT_ID", referencedColumnName = "ID"),
@JoinColumn(name = "'ORDER' as TABLE_NAME", referencedColumnName = "TABLE_NAME") })
private List<TableWithMultiKey> tableWithMultiKey;

}


... I simulate the SQL call and map to myself tablename. Rolling Eyes
Previous Topic:Eclipselink Extensible Entity throw java.lang.NoSuchFieldException
Next Topic:JPA reuse some "previous" JDBC login credentials
Goto Forum:
  


Current Time: Thu Mar 28 11:27:07 GMT 2024

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

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

Back to the top