Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Composite Key OneToOne Join
Composite Key OneToOne Join [message #841617] Wed, 11 April 2012 10:54 Go to next message
Eclipse UserFriend
No Message Body

[Updated on: Fri, 01 December 2023 20:19] by Moderator

Re: Composite Key OneToOne Join [message #841652 is a reply to message #841617] Wed, 11 April 2012 11:37 Go to previous messageGo to next message
Eclipse UserFriend
Remove the @JoinTable, you don't have one, this is not common in a OneToOne, normally just a @JoinColumn is used.

Try,
@JoinColumns({
@JoinColumn(name = "account_col1", referencedColumnName = "sup_col1"),
@JoinColumn(name = "account_col2", referencedColumnName = "sup_col2") })
Re: Composite Key OneToOne Join [message #842269 is a reply to message #841652] Thu, 12 April 2012 02:19 Go to previous messageGo to next message
Eclipse UserFriend
No Message Body

[Updated on: Fri, 01 December 2023 20:19] by Moderator

Re: Composite Key OneToOne Join [message #842373 is a reply to message #842269] Thu, 12 April 2012 04:31 Go to previous messageGo to next message
Eclipse UserFriend
No Message Body

[Updated on: Fri, 01 December 2023 20:20] by Moderator

Re: Composite Key OneToOne Join [message #846652 is a reply to message #842373] Mon, 16 April 2012 10:17 Go to previous message
Eclipse UserFriend
Your Supplier has a OneToMany to Account, so there are many accounts for a Supplier.
You are querying all Suppliers who have "any" account with division='Something', so you will get these back.

The accounts of a Supplier are always the same for that Supplier object, it does not matter how you queried it. You cannot change an object just by a query.

Perhaps use,

SELECT s, a FROM Supplier s
JOIN s.account a 
WHERE s.pk.accountNumber = 1 
AND (s.stat = '20' OR s.stat= '90') 
AND a.pk.division='Something'


This will give you back Suppliers and Accounts.
Previous Topic:Persisting new entity or changing an entity
Next Topic:Default Allocation size for sequence
Goto Forum:
  


Current Time: Tue Jul 22 18:39:22 EDT 2025

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

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

Back to the top