ArchiveOrangemail archive

users.openjpa.apache.org


(List home) (Recent threads) (2 other Apache OpenJPA lists)

Subscription Options

  • RSS or Atom: Read-only subscription using a browser or aggregator. This is the recommended way if you don't need to send messages to the list. You can learn more about feed syndication and clients here.
  • Conventional: All messages are delivered to your mail address, and you can reply. To subscribe, send an email to the list's subscribe address with "subscribe" in the subject line, or visit the list's homepage here.
  • Low traffic list: less than 3 messages per day
  • This list contains about 10,766 messages, beginning Jun 2007
  • 4 messages added yesterday
Report the Spam
This button sends a spam report to the moderator. Please use it sparingly. For other removal requests, read this.
Are you sure? yes no

is it possible to save just the primary key of an object reference?

Ad
garpinc 1344091542Sat, 04 Aug 2012 14:45:42 +0000 (UTC)
I have a scenario where tables are arranged and mapped as follows

TableA -> TableB(with primary key TableC)

to populate TableB I create an instance of TableB and set it's id  using an
instance of TableC and the persist C

What I'd like to do is persist just the pointers to TableC (which will also
later become pointers to TableB when I create a TableB instance)

How would I map that? Since currently the mapping is from TableA->TableB
there is no way to assign TableC instances to that collection on TableA so
I'm having to save both TableB instances and TableC instances at the same
time. The problem for me is I want to fill in TableB and only want to
populate the association now.
Message missing here (more information)
garpinc 1344697481Sat, 11 Aug 2012 15:04:41 +0000 (UTC)
To clarify..
Let's say I have 3 tables..

table A
table AxrefB
table B

and I also have table C which a foreign key to the primary key of A and B
i.e: A(Cpk1), AxrefB(Apk,Cpk2), B(Cpk2)

What I want to do is have a relaxed foreign key constraint so I can save
AxrefB before saving B

So the process would be 
1) I'm saving an A so I create a C1 and assign it to A
2) but A also has a relationship to B so to save that relationship currently
I'd have to create C2 and assign it to B and then assign B to A's collection
and when I save A, B would also be saved.

What I want to do is create C2 and somehow just persist AxrefB.
Then later when i'm persisting B I look for C2 using other criteria that
relates B to C2 and then assign C2 to B and finally save B.

So is there a way to map this?
Home | About | Privacy