<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-27110</id>
	<title>Nabble - JPA General</title>
	<updated>2009-11-12T14:02:06Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/JPA-General-f27110.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/JPA-General-f27110.html" />
	<subtitle type="html">Independent forum for general JPA (Java Persistence API) questions.</subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26327300</id>
	<title>Trouble building one-to-many in my Java model</title>
	<published>2009-11-12T14:02:06Z</published>
	<updated>2009-11-12T14:02:06Z</updated>
	<author>
		<name>laredotornado</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;I'm using Eclipse Galileo on Mac 10.5.6, Oracle 10g, Java 1.5, and Hibernate 3.3.0.GA. &amp;nbsp;I'm trying to build a Java model in which I want one field to have a one-to-many relationship to another model. &amp;nbsp;The corresponding db tables have been created. &amp;nbsp;In my .java class, I tried defining it like this ...
&lt;br&gt;&lt;br&gt;&amp;nbsp; @OneToMany
&lt;br&gt;&amp;nbsp; @JoinTable(name = &amp;quot;VENDOR_EMAILS&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; joinColumns = {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;VENDOR_ID&amp;quot;, unique = true) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; },
&lt;br&gt;&amp;nbsp; &amp;nbsp; inverseJoinColumns = {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;VENDOR_ID&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; )
&lt;br&gt;&amp;nbsp; private List&amp;lt;YouthfulDriverVendorEmail&amp;gt; emails;
&lt;br&gt;&lt;br&gt;but I'm getting these compilation errors ...
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] Compiling 4 source files to /Users/dalvarado/source/youthful/model/target/classes
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] /Users/dalvarado/source/youthful/model/src/main/java/myco/dor/dmv/driver/youthful/model/YouthfulDriverVendor.java:52: cannot find symbol
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] symbol &amp;nbsp;: class OneToMany
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] location: class myco.dor.dmv.driver.youthful.model.YouthfulDriverVendor
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] &amp;nbsp; @OneToMany
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] &amp;nbsp; &amp;nbsp;^
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] /Users/dalvarado/source/youthful/model/src/main/java/myco/dor/dmv/driver/youthful/model/YouthfulDriverVendor.java:53: cannot find symbol
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] symbol &amp;nbsp;: class JoinTable
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] location: class myco.dor.dmv.driver.youthful.model.YouthfulDriverVendor
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] &amp;nbsp; @JoinTable(name = &amp;quot;VENDOR_EMAILS&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] &amp;nbsp; &amp;nbsp;^
&lt;br&gt;&amp;nbsp; &amp;nbsp; [javac] 2 errors
&lt;br&gt;&lt;br&gt;Does anyone know what I'm doing wrong? &amp;nbsp;Below is the complete code for my class. &amp;nbsp;Thanks in advance, - Dave
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;package myco.dor.dmv.driver.youthful.model;
&lt;br&gt;&lt;br&gt;import java.io.File;
&lt;br&gt;import java.io.Serializable;
&lt;br&gt;import java.util.Date;
&lt;br&gt;import java.util.List;
&lt;br&gt;&lt;br&gt;import javax.persistence.Id;
&lt;br&gt;import javax.persistence.Table;
&lt;br&gt;import javax.persistence.Column;
&lt;br&gt;import javax.persistence.Entity;
&lt;br&gt;import javax.persistence.GeneratedValue;
&lt;br&gt;import javax.persistence.SequenceGenerator;
&lt;br&gt;&lt;br&gt;@Entity
&lt;br&gt;@Table(name=&amp;quot;VENDORS&amp;quot;)
&lt;br&gt;public class YouthfulDriverVendor implements Serializable {
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static final long serialVersionUID = -1L;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; @Id
&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;VENDOR_ID&amp;quot;)
&lt;br&gt;&amp;nbsp; @GeneratedValue(generator=&amp;quot;VENDORID_GENERATOR&amp;quot;)
&lt;br&gt;&amp;nbsp; @SequenceGenerator(name=&amp;quot;VENDORID_GENERATOR&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sequenceName=&amp;quot;VENDOR_ID&amp;quot;)
&lt;br&gt;&amp;nbsp; private Long vendorId;
&lt;br&gt;&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;CUSTOMER_ID&amp;quot;)
&lt;br&gt;&amp;nbsp; private Long customerId;
&lt;br&gt;&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;ACTIVATION_DATE&amp;quot;)
&lt;br&gt;&amp;nbsp; private Date activationDate;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;EXPIRATION_DATE&amp;quot;)
&lt;br&gt;&amp;nbsp; private Date expirationDate;
&lt;br&gt;&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;KEY_ID&amp;quot;, length=128)
&lt;br&gt;&amp;nbsp; private String keyId;
&lt;br&gt;&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;VENDOR_NAME&amp;quot;, length=512)
&lt;br&gt;&amp;nbsp; private String vendorName;
&lt;br&gt;&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;FTP_HOME&amp;quot;, length=512)
&lt;br&gt;&amp;nbsp; private String ftpHome;
&lt;br&gt;&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;USER_NAME&amp;quot;, length=64)
&lt;br&gt;&amp;nbsp; private String username;
&lt;br&gt;&lt;br&gt;&amp;nbsp; @Column(name=&amp;quot;EMAIL&amp;quot;, length=256)
&lt;br&gt;&amp;nbsp; private String email;
&lt;br&gt;&lt;br&gt;&amp;nbsp; @OneToMany
&lt;br&gt;&amp;nbsp; @JoinTable(name = &amp;quot;VENDOR_EMAILS&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; joinColumns = {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;VENDOR_ID&amp;quot;, unique = true) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; },
&lt;br&gt;&amp;nbsp; &amp;nbsp; inverseJoinColumns = {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;VENDOR_ID&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; )
&lt;br&gt;&amp;nbsp; private List&amp;lt;YouthfulDriverVendorEmail&amp;gt; emails;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; public List&amp;lt;YouthfulDriverVendorEmail&amp;gt; getEmails() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return emails;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; public void setEmails(List&amp;lt;YouthfulDriverVendorEmail&amp;gt; emails) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.emails = emails;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;/**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;VendorId&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;Long&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public Long getVendorId() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return vendorId;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;VendorId&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newVendorId The new VendorId value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setVendorId(final Long newVendorId) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.vendorId = newVendorId;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;CustomerId&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;Long&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public Long getCustomerId() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return customerId;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;CustomerId&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newCustomerId The new CustomerId value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setCustomerId(final Long newCustomerId) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.customerId = newCustomerId;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;ActivationDate&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;Date&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public Date getActivationDate() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return activationDate;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;ActivationDate&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newActivationDate The new ActivationDate value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setActivationDate(final Date newActivationDate) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.activationDate = newActivationDate;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;ExpirationDate&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;Date&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public Date getExpirationDate() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return expirationDate;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;ExpirationDate&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newExpirationDate The new ExpirationDate value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setExpirationDate(final Date newExpirationDate) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.expirationDate = newExpirationDate;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;KeyId&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public String getKeyId() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return keyId;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;KeyId&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newKeyId The new KeyId value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setKeyId(final String newKeyId) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.keyId = newKeyId;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;VendorName&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public String getVendorName() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return vendorName;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;VendorName&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newVendorName The new VendorName value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setVendorName(final String newVendorName) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.vendorName = newVendorName;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;FtpHome&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public String getFtpHome() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return ftpHome;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the Ftp Inbox value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a File object containing this value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/ &amp;nbsp;
&lt;br&gt;&amp;nbsp; public File getFtpInbox() { 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return new File(this.getFtpHome(), &amp;quot;INBOX&amp;quot;); &amp;nbsp;
&lt;br&gt;&amp;nbsp; }		// getFtpInbox
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the Ftp Inbox value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a File object containing this value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/ &amp;nbsp;
&lt;br&gt;&amp;nbsp; public File getFtpOutbox() { 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return new File(this.getFtpHome(), &amp;quot;OUTBOX&amp;quot;); &amp;nbsp;
&lt;br&gt;&amp;nbsp; }		// getFtpInbox
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;FtpHome&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newFtpHome The new FtpHome value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setFtpHome(final String newFtpHome) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.ftpHome = newFtpHome;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;Username&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public String getUsername() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return username;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;Username&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newUsername The new Username value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setUsername(final String newUsername) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.username = newUsername;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Get the &amp;lt;code&amp;gt;Email&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @return a &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt; value
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public String getEmail() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; return email;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; /**
&lt;br&gt;&amp;nbsp; &amp;nbsp;* Set the &amp;lt;code&amp;gt;Email&amp;lt;/code&amp;gt; value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*
&lt;br&gt;&amp;nbsp; &amp;nbsp;* @param newEmail The new Email value.
&lt;br&gt;&amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; public void setEmail(final String newEmail) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; this.email = newEmail;
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;}</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Trouble-building-one-to-many-in-my-Java-model-tp26327300p26327300.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26320221</id>
	<title>Re: remove in a loop</title>
	<published>2009-11-12T07:02:38Z</published>
	<updated>2009-11-12T07:02:38Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">The only thing I can think of, is you have another object that still has a reference to the deleted object, that is causing it to be re-persisted. &amp;nbsp;Otherwise you might need to try to debug it by added a breakpoint into the EclipseLink UnitOfWorkImpl code and inspecting its state.
&lt;br&gt;&lt;br&gt;It could be a bug in TopLink Essentials, try upgrading to the latest EclipseLink release and see if the issue still occurs.
&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/remove-in-a-loop-tp26301540p26320221.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26303264</id>
	<title>Re: remove in a loop</title>
	<published>2009-11-11T08:00:21Z</published>
	<updated>2009-11-11T08:00:21Z</updated>
	<author>
		<name>Nocia</name>
	</author>
	<content type="html">Fore sure I find that strange too...
&lt;br&gt;&lt;br&gt;No, I checked the values returned and I did the test both case with exactly the same data.
&lt;br&gt;Here are the results of log :
&lt;br&gt;&lt;br&gt;for the first case with no flush or flush at the end (where I printed the id in the loop):
&lt;br&gt;&lt;br&gt;Printed id : 113
&lt;br&gt;The remove operation has been performed on: AbstractFlow[id=113]
&lt;br&gt;Printed id : 72
&lt;br&gt;The remove operation has been performed on: AbstractFlow[id=72]
&lt;br&gt;Printed id : 119
&lt;br&gt;The remove operation has been performed on: AbstractFlow[id=119]
&lt;br&gt;TX beginTransaction, status=STATUS_ACTIVE
&lt;br&gt;Execute query DeleteObjectQuery(AbstractFlow[id=113])
&lt;br&gt;reconnecting to external connection pool
&lt;br&gt;DELETE FROM flow WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [113]
&lt;br&gt;DELETE FROM abstract_flow WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [113]
&lt;br&gt;Unregister the object AbstractFlow[id=113]
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;In the second case:
&lt;br&gt;&lt;br&gt;Printed id : 113
&lt;br&gt;&lt;br&gt;Execute query DeleteObjectQuery(AbstractFlow[id=113])
&lt;br&gt;reconnecting to external connection pool
&lt;br&gt;DELETE FROM flow WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [113]
&lt;br&gt;DELETE FROM abstract_flow WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [113]
&lt;br&gt;Unregister the object AbstractFlow[id=113]
&lt;br&gt;&lt;br&gt;Printed id : 72
&lt;br&gt;&lt;br&gt;The remove operation has been performed on: AbstractFlow[id=72]
&lt;br&gt;Execute query DeleteObjectQuery(AbstractFlow[id=72])
&lt;br&gt;DELETE FROM flow WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [72]
&lt;br&gt;DELETE FROM abstract_flow WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [72]
&lt;br&gt;Unregister the object AbstractFlow[id=72]
&lt;br&gt;&lt;br&gt;Printed id : 119
&lt;br&gt;&lt;br&gt;The remove operation has been performed on: AbstractFlow[id=119]
&lt;br&gt;Execute query DeleteObjectQuery(AbstractFlow[id=119])
&lt;br&gt;DELETE FROM flow WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [119]
&lt;br&gt;DELETE FROM abstract_flow WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [119]
&lt;br&gt;&lt;br&gt;&lt;br&gt;We can see that in both case the delete request are done but only in the second case they are all performed...
&lt;br&gt;&lt;br&gt;I use TopLink version 2.1-b60e-fcs (12/23/2008)</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/remove-in-a-loop-tp26301540p26303264.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26302582</id>
	<title>Re: remove in a loop</title>
	<published>2009-11-11T07:04:18Z</published>
	<updated>2009-11-11T07:04:18Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">That does not seem possible. &amp;nbsp;Is an error occurring? &amp;nbsp;Perhaps turn on logging to finest.
&lt;br&gt;&lt;br&gt;The only thing that I can think of, is all of your object's have the same Id, or perhaps a null Id.
&lt;br&gt;&lt;br&gt;What version of TopLink are you using? &amp;nbsp;Perhaps try the latest EclipseLink release.
&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/remove-in-a-loop-tp26301540p26302582.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26301540</id>
	<title>remove in a loop</title>
	<published>2009-11-11T05:52:47Z</published>
	<updated>2009-11-11T05:52:47Z</updated>
	<author>
		<name>Nocia</name>
	</author>
	<content type="html">Hi all,
&lt;br&gt;&lt;br&gt;I'm using JEE5 with TopLink.
&lt;br&gt;&lt;br&gt;In one of my session bean, I have a method to delete a list of entity which does :
&lt;br&gt;&lt;br&gt;&amp;nbsp; Query q = em.createQuery(query);
&lt;br&gt;&amp;nbsp; List&amp;lt;ICRUDEntity&amp;gt; entities = q.getResultList();
&lt;br&gt;&amp;nbsp; for(ICRUDEntity entity : entities)
&lt;br&gt;&amp;nbsp; &amp;nbsp; em.remove(entity);
&lt;br&gt;&amp;nbsp; //em.flush();
&lt;br&gt;&lt;br&gt;But in this case only the first entity of the list is deleted. Add em.flush() at the end doesn't change this behaviour.
&lt;br&gt;&lt;br&gt;The only way to make it work is to add a flush after next remove call:
&lt;br&gt;&lt;br&gt;&amp;nbsp; Query q = em.createQuery(query);
&lt;br&gt;&amp;nbsp; List&amp;lt;ICRUDEntity&amp;gt; entities = q.getResultList();
&lt;br&gt;&amp;nbsp; for(ICRUDEntity entity : entities) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; em.remove(entity);
&lt;br&gt;&amp;nbsp; &amp;nbsp; em.flush();
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;But I don't understand why I'm obligated to use such a workaround.
&lt;br&gt;&lt;br&gt;Have I anything wrong? Is this a bug of toplink? 
&lt;br&gt;&lt;br&gt;Thanks for your /*comments*/ 
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/remove-in-a-loop-tp26301540p26301540.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26197166</id>
	<title>Re: How do I get Table Metadata with JPA ?</title>
	<published>2009-11-04T06:24:47Z</published>
	<updated>2009-11-04T06:24:47Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">There is nothing in JPA for this.
&lt;br&gt;&lt;br&gt;You can query your database catalog tables directly using native SQL, or use the JDBC API's directly.
&lt;br&gt;&lt;br&gt;If you are using EclipseLink, there is an API on SchemaManager.getAllColumnNames() that will return the column meta-data from the database.
&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-do-I-get-Table-Metadata-with-JPA---tp26192055p26197166.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26197072</id>
	<title>Re: URGENT: OneToOne mapping NOT on PK or FK</title>
	<published>2009-11-04T06:19:27Z</published>
	<updated>2009-11-04T06:19:27Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">Perhaps include the schema and your object model.
&lt;br&gt;&lt;br&gt;If the employeeId is not the Id of the Entity, then how this can be mapped may depend on your JPA provider.
&lt;br&gt;For the supervisorId, this should just be a normal OneToOne mapping.
&lt;br&gt;&lt;br&gt;See,
&lt;br&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence/OneToOne&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://en.wikibooks.org/wiki/Java_Persistence/OneToOne&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence/Relationships#Filtering.2C_Complex_Joins&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://en.wikibooks.org/wiki/Java_Persistence/Relationships#Filtering.2C_Complex_Joins&lt;/a&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/URGENT%3A-OneToOne-mapping-NOT-on-PK-or-FK-tp26160615p26197072.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26192055</id>
	<title>How do I get Table Metadata with JPA ?</title>
	<published>2009-11-03T23:29:59Z</published>
	<updated>2009-11-03T23:29:59Z</updated>
	<author>
		<name>ajay rs</name>
	</author>
	<content type="html">I want to get all column's length form database table.
&lt;br&gt;How can I have table metadata ? Is there any method or annotation?
&lt;br&gt;&lt;br&gt;I tried @Column annotaion, but there I have to set these all. But I want original length defined in table structure itself.
&lt;br&gt;&lt;br&gt;Any help regarding this will be appriciated.
&lt;br&gt;Thanks
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-do-I-get-Table-Metadata-with-JPA---tp26192055p26192055.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26160615</id>
	<title>URGENT: OneToOne mapping NOT on PK or FK</title>
	<published>2009-11-03T09:46:06Z</published>
	<updated>2009-11-03T09:46:06Z</updated>
	<author>
		<name>bmelloni</name>
	</author>
	<content type="html">Sorry about the Urgent, I am supposed to finish this today.
&lt;br&gt;&lt;br&gt;1) I am mapping 2 tables (employee and person) that I cannot change. &amp;nbsp;Both tables contain an employeeId and have a 1-1 relationship based on it, but the employeeId column is NOT the PK in either table. &amp;nbsp;The @OneToOne mapping seems to require something like employee.personID to map to the PK of person.
&lt;br&gt;&lt;br&gt;How can I map the relationship based on employeeId column? &amp;nbsp;
&lt;br&gt;&lt;br&gt;2) Again, in the employee table, I have a supervisorId column (this one does contain the PK).
&lt;br&gt;&lt;br&gt;How do I map the relationship from employee to employee based on the supervisorId?</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/URGENT%3A-OneToOne-mapping-NOT-on-PK-or-FK-tp26160615p26160615.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26160612</id>
	<title>URGENT: OneToOne mapping NOT on PK/FK</title>
	<published>2009-11-03T09:45:20Z</published>
	<updated>2009-11-03T09:45:20Z</updated>
	<author>
		<name>bmelloni</name>
	</author>
	<content type="html">Sorry about the Urgent, I am supposed to finish this today.
&lt;br&gt;&lt;br&gt;1) I am mapping 2 tables (employee and person) that I cannot change. &amp;nbsp;Both tables contain an employeeId and have a 1-1 relationship based on it, but the employeeId column is NOT the PK in either table. &amp;nbsp;The @OneToOne mapping seems to require something like employee.personID to map to the PK of person.
&lt;br&gt;&lt;br&gt;How can I map the relationship based on employeeId column? &amp;nbsp;
&lt;br&gt;&lt;br&gt;2) Again, in the employee table, I have a supervisorId column (this one does contain the PK).
&lt;br&gt;&lt;br&gt;How do I map the relationship from employee to employee based on the supervisorId?</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/URGENT%3A-OneToOne-mapping-NOT-on-PK-FK-tp26160612p26160612.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26160611</id>
	<title>URGENT: @OneToOne mapping NOT on PK/FK</title>
	<published>2009-11-03T09:45:06Z</published>
	<updated>2009-11-03T09:45:06Z</updated>
	<author>
		<name>bmelloni</name>
	</author>
	<content type="html">Sorry about the Urgent, I am supposed to finish this today.
&lt;br&gt;&lt;br&gt;1) I am mapping 2 tables (employee and person) that I cannot change. &amp;nbsp;Both tables contain an employeeId and have a 1-1 relationship based on it, but the employeeId column is NOT the PK in either table. &amp;nbsp;The @OneToOne mapping seems to require something like employee.personID to map to the PK of person.
&lt;br&gt;&lt;br&gt;How can I map the relationship based on employeeId column? &amp;nbsp;
&lt;br&gt;&lt;br&gt;2) Again, in the employee table, I have a supervisorId column (this one does contain the PK).
&lt;br&gt;&lt;br&gt;How do I map the relationship from employee to employee based on the supervisorId?</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/URGENT%3A-%40OneToOne-mapping-NOT-on-PK-FK-tp26160611p26160611.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26160610</id>
	<title>URGENT: @OneToOne mapping NOT on PK/FK</title>
	<published>2009-11-03T09:44:55Z</published>
	<updated>2009-11-03T09:44:55Z</updated>
	<author>
		<name>bmelloni</name>
	</author>
	<content type="html">Sorry about the Urgent, I am supposed to finish this today.
&lt;br&gt;&lt;br&gt;1) I am mapping 2 tables (employee and person) that I cannot change. &amp;nbsp;Both tables contain an employeeId and have a 1-1 relationship based on it, but the employeeId column is NOT the PK in either table. &amp;nbsp;The @OneToOne mapping seems to require something like employee.personID to map to the PK of person.
&lt;br&gt;&lt;br&gt;How can I map the relationship based on employeeId column? &amp;nbsp;
&lt;br&gt;&lt;br&gt;2) Again, in the employee table, I have a supervisorId column (this one does contain the PK).
&lt;br&gt;&lt;br&gt;How do I map the relationship from employee to employee based on the supervisorId?</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/URGENT%3A-%40OneToOne-mapping-NOT-on-PK-FK-tp26160610p26160610.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26157098</id>
	<title>Re: merge/update object in collection</title>
	<published>2009-11-02T06:06:20Z</published>
	<updated>2009-11-02T06:06:20Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">Not sure what you are doing. &amp;nbsp;Perhaps include your logs and some more detail on exactly what you are doing, and what you want to occur.
&lt;br&gt;&lt;br&gt;In general merge() is used when you have a copy of an object, normally through object serialization, such as across RMI. &amp;nbsp;Are you serializing objects to the UI? &amp;nbsp;Or why are you using merge? &amp;nbsp;It seems you may be getting confused on you copies of objects and corrupting your object copies.
&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/merge-update-object-in-collection-tp26127584p26157098.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26127584</id>
	<title>merge/update object in collection</title>
	<published>2009-10-30T03:09:05Z</published>
	<updated>2009-10-30T03:09:05Z</updated>
	<author>
		<name>SMaton</name>
	</author>
	<content type="html">Hi everyone,
&lt;br&gt;&lt;br&gt;I've a strange problem on hand which I've been discussing with several people but up to date no one could help me. So, here we go:
&lt;br&gt;&lt;br&gt;I've a class named Investor which holds a collection of email addresses. Each email address is itself a class object containing the email string and the email type (private, business, ...).
&lt;br&gt;&lt;br&gt;The downstripped versions look like this:
&lt;br&gt;&lt;br&gt;@Entity
&lt;br&gt;@Table(name = &amp;quot;INVESTORS&amp;quot;)
&lt;br&gt;@UniqueInvestorName
&lt;br&gt;public class Investor extends BasicBO implements
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; be.sidema.model.Investor {
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @OneToMany(fetch=FetchType.LAZY, cascade= {CascadeType.ALL}, targetEntity=be.sidema.model.jpa.InvestorEmail.class)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;investor_id&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @PrivateOwned
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public List&amp;lt;InvestorEmail&amp;gt; emails = new ArrayList&amp;lt;InvestorEmail&amp;gt;();
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public List&amp;lt;? extends InvestorEmail&amp;gt; getEmails() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return emails;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setEmails(List&amp;lt;InvestorEmail&amp;gt; emails) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Object oldValue = this.emails;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.emails = emails;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firePropertyChange(PROPERTY_EMAILS, oldValue, this.emails);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void addEmail(InvestorEmail _email) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int oldSize = this.emails.size();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; emails.add(_email);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firePropertyChange(PROPERTY_EMAILS, oldSize, this.emails.size());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void removeEmail(InvestorEmail _email) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int oldSize = this.emails.size();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; emails.remove(_email);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firePropertyChange(PROPERTY_EMAILS, oldSize, this.emails.size());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;@Entity
&lt;br&gt;@Table(name = &amp;quot;INVESTOR_EMAILS&amp;quot;)
&lt;br&gt;public class InvestorEmail extends BasicBO implements
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; be.sidema.model.InvestorEmail {
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @ManyToOne(targetEntity = be.sidema.model.jpa.InvestorEmailType.class, cascade= {CascadeType.ALL})
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name = &amp;quot;email_type_id&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private InvestorEmailType type;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private String email;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public InvestorEmailType getType() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return type;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setType(InvestorEmailType type) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Object oldValue = this.type;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.type = type;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firePropertyChange(PROPERTY_TYPE, oldValue, this.type);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public String getEmail() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return email;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setEmail(String email) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Object oldValue = this.email;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.email = email;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firePropertyChange(PROPERTY_EMAIL, oldValue, this.email);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;@Entity
&lt;br&gt;@Table(name = &amp;quot;INVESTOR_EMAIL_TYPES&amp;quot;)
&lt;br&gt;public class InvestorEmailType extends BasicBO implements
&lt;br&gt;be.sidema.model.InvestorEmailType {
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private String type;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public String getType() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return type;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public String toString() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return getType();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setType(String type) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Object oldValue = this.type;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.type = type;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firePropertyChange(PROPERTY_TYPE, oldValue, this.type);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;Problem description:
&lt;br&gt;&lt;br&gt;In my database I have an existing Investor who has an existing email address. The email type is set to &amp;quot;business&amp;quot;. Within my UI I have opened an editor displaying the investor data. From within this editor I open a second editor enabling me to alter the email address content.
&lt;br&gt;&lt;br&gt;I change the email address content from &amp;quot;Business&amp;quot; to &amp;quot;Private&amp;quot; and do a merge to the InvestorEmailAddress object in my service:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Override
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Transactional
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public InvestorEmail saveEmail(InvestorEmail _email) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _email.markCommitted();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InvestorEmail result = entityManager.merge(_email);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; entityManager.flush();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return result;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;Upon the first merge, the debug output I get is:
&lt;br&gt;&lt;br&gt;UPDATE INVESTOR_EMAILS SET email_type_id = ? WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [2, 2451]
&lt;br&gt;&lt;br&gt;I use the return value of the merge operation to update my email address editor.
&lt;br&gt;&lt;br&gt;At this point the data within the collection of my investor reflects the right state (which is &amp;quot;Private&amp;quot;).
&lt;br&gt;&lt;br&gt;Without quitting the email editor I then re-edit the address type back from &amp;quot;Private&amp;quot; to &amp;quot;Business&amp;quot;. Upon the merge I now get this:
&lt;br&gt;&lt;br&gt;UPDATE INVESTOR_EMAILS SET UPDATED_AT = ?, email_type_id = ? WHERE (ID = ?)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bind =&amp;gt; [2009-10-30 10:21:22.253, 1, 2451]
&lt;br&gt;&lt;br&gt;Any further merge does look like this from now on. The UPDATED_AT is set.
&lt;br&gt;&lt;br&gt;&lt;br&gt;The problem:
&lt;br&gt;&lt;br&gt;After the second and any further merge operation, the content of the collection of my investor does not reflect the changes to the email object. The collection doesn't get &amp;quot;refreshed&amp;quot; upon the next access.
&lt;br&gt;&lt;br&gt;I am aware that the object can change when a merge is done, but I thought that I don't have to &amp;quot;pass by hand&amp;quot; the change to the collection of my investor.
&lt;br&gt;&lt;br&gt;Am I missing something?
&lt;br&gt;&lt;br&gt;Best regards,
&lt;br&gt;Stefan</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/merge-update-object-in-collection-tp26127584p26127584.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26120289</id>
	<title>Could not find datasource</title>
	<published>2009-10-29T13:37:20Z</published>
	<updated>2009-10-29T13:37:20Z</updated>
	<author>
		<name>pedjasmek</name>
	</author>
	<content type="html">I'm getting &amp;quot;Could not find datasource&amp;quot; message when I run my jpa project.This is my persistence.xml file:
&lt;br&gt;[code]
&lt;br&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;lt;persistence version=&amp;quot;1.0&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns=&amp;quot;&lt;a href=&quot;http://java.sun.com/xml/ns/persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/xml/ns/persistence&lt;/a&gt;&amp;quot; xmlns:xsi=&amp;quot;&lt;a href=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/a&gt;&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xsi:schemaLocation=&amp;quot;&lt;a href=&quot;http://java.sun.com/xml/ns/persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/xml/ns/persistence&lt;/a&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&lt;/a&gt;&amp;quot;&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;persistence-unit name=&amp;quot;Prodavnica_jpa&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; transaction-type=&amp;quot;JTA&amp;quot;&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;provider&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; org.hibernate.ejb.HibernatePersistence
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/provider&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;jta-data-source&amp;gt;java:/JPATestDataSource&amp;lt;/jta-data-source&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;class&amp;gt;com.spinnaker.pedja.Book&amp;lt;/class&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;class&amp;gt;com.spinnaker.pedja.Cart&amp;lt;/class&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;class&amp;gt;com.spinnaker.pedja.CartItem&amp;lt;/class&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;class&amp;gt;com.spinnaker.pedja.Customer&amp;lt;/class&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;class&amp;gt;com.spinnaker.pedja.Item&amp;lt;/class&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;class&amp;gt;com.spinnaker.pedja.Music&amp;lt;/class&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;class&amp;gt;com.spinnaker.pedja.Video&amp;lt;/class&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;properties&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.show_sql&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.format_sql&amp;quot; value=&amp;quot;true&amp;quot; /&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.connection.driver_class&amp;quot; value=&amp;quot;com.mysql.jdbc.Driver&amp;quot;/&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.connection.url&amp;quot; value=&amp;quot;jdbc:mysql://localhost:3306/shop&amp;quot; /&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.connection.username&amp;quot; value=&amp;quot;root&amp;quot;/&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.dialect&amp;quot; value=&amp;quot;org.hibernate.dialect.MySQLDialect&amp;quot; /&amp;gt;
&lt;br&gt;&amp;lt;!--			&amp;lt;property name=&amp;quot;jboss.entity.manager.factory.jndi.name&amp;quot;--&amp;gt;
&lt;br&gt;&amp;lt;!--				value=&amp;quot;java:/MyProjectEntityManagerFactory&amp;quot; /&amp;gt;--&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.hbm2ddl.auto&amp;quot; value=&amp;quot;update&amp;quot; /&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/properties&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/persistence-unit&amp;gt;
&lt;br&gt;&amp;lt;/persistence&amp;gt;
&lt;br&gt;[/code]
&lt;br&gt;Let me know if I should add additional info.
&lt;br&gt;How should I fix this problem?Thanks</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Could-not-find-datasource-tp26120289p26120289.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25965968</id>
	<title>Re: Mapping question</title>
	<published>2009-10-19T14:28:11Z</published>
	<updated>2009-10-19T14:28:11Z</updated>
	<author>
		<name>ttomor</name>
	</author>
	<content type="html">Thank you very much.
&lt;br&gt;&lt;br&gt;This seems to be the solution.
&lt;br&gt;&lt;br&gt;Tomor
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Mapping-question-tp25942512p25965968.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25960349</id>
	<title>Re: Mapping question</title>
	<published>2009-10-19T08:31:22Z</published>
	<updated>2009-10-19T08:31:22Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">You need to make an Entity for the Teaches table. &amp;nbsp;Some instead of a ManyToMany use a OneToMany,
&lt;br&gt;&lt;br&gt;see,
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence/ManyToMany#Mapping_a_Join_Table_with_Additional_Columns&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://en.wikibooks.org/wiki/Java_Persistence/ManyToMany#Mapping_a_Join_Table_with_Additional_Columns&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Mapping-question-tp25942512p25960349.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25942512</id>
	<title>Mapping question</title>
	<published>2009-10-17T15:52:41Z</published>
	<updated>2009-10-17T15:52:41Z</updated>
	<author>
		<name>ttomor</name>
	</author>
	<content type="html">Hi, 
&lt;br&gt;This is my db schema which looks like this:
&lt;br&gt;&lt;img src=&quot;http://old.nabble.com/file/p25942512/3tabelat.jpg&quot; border=&quot;0&quot; /&gt;&lt;br&gt;&lt;br&gt;So a staff (which is a teacher) can teach a specific subject (curriculum) to a specific class (class_id).
&lt;br&gt;&lt;br&gt;As you can see 'teaches' is the table where all the tables meet. I've tried the Dali tool and it did a pretty good job, by producing something like this (The 'Staff' entity, not entirely quoted, just the parts which have to do with 'teaches'): 
&lt;br&gt;&lt;br&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //uni-directional many-to-many association to Curriculum
&lt;br&gt;&amp;nbsp; &amp;nbsp; @ManyToMany
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinTable(
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name=&amp;quot;teaches&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , joinColumns={
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;staff_id&amp;quot;, referencedColumnName=&amp;quot;staff_id&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , inverseJoinColumns={
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;class&amp;quot;, referencedColumnName=&amp;quot;class&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;subject_id&amp;quot;, referencedColumnName=&amp;quot;subject_id&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;year&amp;quot;, referencedColumnName=&amp;quot;year&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Set&amp;lt;Curriculum&amp;gt; curriculums;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //bi-directional many-to-many association to Class
&lt;br&gt;&amp;nbsp; &amp;nbsp; @ManyToMany
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinTable(
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name=&amp;quot;teaches&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , joinColumns={
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;staff_id&amp;quot;, referencedColumnName=&amp;quot;staff_id&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , inverseJoinColumns={
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;class_id&amp;quot;, referencedColumnName = &amp;quot;class_id&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Collection&amp;lt;Class&amp;gt; clazzs;&lt;/i&gt;&lt;br&gt;&lt;br&gt;But this makes problem when I want to persist a new Staff object, which 'teaches' a specific subject (year, class, subject_id) to a specific class_id, because it doesn't know which class_id with which subject go together. Could you please help me with a better solution for this?
&lt;br&gt;&lt;br&gt;Help is appreciated
&lt;br&gt;&lt;br&gt;Sincerely yours,
&lt;br&gt;tomor</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Mapping-question-tp25942512p25942512.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25937933</id>
	<title>JPA &amp; Hibernate: Does a Query not return a proxy collection ?</title>
	<published>2009-10-17T05:38:22Z</published>
	<updated>2009-10-17T05:38:22Z</updated>
	<author>
		<name>megloff</name>
	</author>
	<content type="html">Hello
&lt;br&gt;&lt;br&gt;I am using JPA with Hibernate (v3.3.1.). Something astonsihes me. When I do a query I noticed that the returned list is a normal &amp;quot;java.util.ArrayList&amp;quot;. I expected a kind of proxy collection so that it supports a &amp;quot;lazy loading&amp;quot; (loading of the list elements itself at run time when needed) means if I would later iterate over the list that hibernate fills the list on demand.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Query query = entityManager.createQuery ( &amp;quot;from Customer&amp;quot; );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; query.setHint(&amp;quot;org.hibernate.fetchSize&amp;quot;, 10);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; log.info(&amp;quot;returned type of getResultList(): &amp;quot; + query.getResultList().getClass());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List list = query.getResultList();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(Object c : list) System.out.println(c); &amp;nbsp;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this prints out the following type for the &amp;quot;ResultList&amp;quot; class:
&lt;br&gt;&lt;br&gt;[StandardQueryCache] starting query cache at region: regionname
&lt;br&gt;[AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
&lt;br&gt;Hibernate: select customer0_.customer_id as customer1_1_, customer0_.customer_type as customer2_1_, customer0_.gender as gender1_, customer0_.last_name as last4_1_, customer0_.given_name as given5_1_, customer0_.company_name as company6_1_, customer0_.cust_domicile as cust7_1_, customer0_.street_address as street8_1_, customer0_.zip_code as zip9_1_, customer0_.city as city1_, customer0_.corres_code as corres11_1_, customer0_.domicile_Status as domicile12_1_, customer0_.advisor_branch_code as advisor13_1_, customer0_.advisor_dept_code as advisor14_1_, customer0_.cust_form as cust15_1_, customer0_.cust_category as cust16_1_, customer0_.cust_grade as cust17_1_, customer0_.cust_segment as cust18_1_, customer0_.civil_status as civil19_1_, customer0_.nationality1 as nationa20_1_, customer0_.nationality_status as nationa21_1_ from DTN_CUSTOMER customer0_
&lt;br&gt;[AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
&lt;br&gt;[AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
&lt;br&gt;[AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
&lt;br&gt;&lt;br&gt;returned type of getResultList(): class java.util.ArrayList
&lt;br&gt;&lt;br&gt;Customer [id=1-0000-0001, lastName=xxx, givenName=xxx, birthDate=Sat Oct 17 14:23:14 CEST 2009]
&lt;br&gt;Customer [id=1-0000-0002, lastName=yyy, givenName=yyy, city=Wetzikon, birthDate=Sat Oct 17 14:23:14 CEST 2009]
&lt;br&gt;Customer [id=1-0000-0003, lastName=zzz, givenName=zzz, city=Hinwil, birthDate=Sat Oct 17 14:23:14 CEST 2009]
&lt;br&gt;....
&lt;br&gt;&lt;br&gt;I expected that when I iterate over the 11th customer then I would notice another sql fetch but obviously this seems not to be case. Rather than this it gets all customers of the database.
&lt;br&gt;&lt;br&gt;So in case you have many customers it would get slow or even produces an out of memory error... I am quite sure that here something exists how to avoid this kind of situation. The question is now for me, does a proxy collection for hibernate &amp; JPA exist in case of queries? If yes please provide a link or example how the configuration therefore needs to be made. I did not found &amp;nbsp;any kind of hints so far, only in case if you have sub attributes (one-to- many etc.)
&lt;br&gt;&lt;br&gt;Here my snippet code how I use it today.
&lt;br&gt;&lt;br&gt;Annotations of my Customer class:
&lt;br&gt;&lt;br&gt;@Entity
&lt;br&gt;@Table (name=&amp;quot;DTN_CUSTOMER&amp;quot;)
&lt;br&gt;@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
&lt;br&gt;public class Customer implements Serializable {.... }
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;JPA persistence.xml:
&lt;br&gt;&lt;br&gt;&amp;lt;persistence xmlns=&amp;quot;&lt;a href=&quot;http://java.sun.com/xml/ns/persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/xml/ns/persistence&lt;/a&gt;&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:xsi=&amp;quot;&lt;a href=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/a&gt;&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xsi:schemaLocation=&amp;quot;&lt;a href=&quot;http://java.sun.com/xml/ns/persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/xml/ns/persistence&lt;/a&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&lt;/a&gt;&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; version=&amp;quot;1.0&amp;quot;&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;persistence-unit name=&amp;quot;pbm&amp;quot;&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;class&amp;gt;entity.Customer&amp;lt;/class&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;properties&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.show_sql&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt; 			
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.hbm2ddl.auto&amp;quot; value=&amp;quot;validate&amp;quot; /&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.cache.use_second_level_cache&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.cache.use_query_cache&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;hibernate.cache.provider_class&amp;quot; value=&amp;quot;net.sf.ehcache.hibernate.SingletonEhCacheProvider&amp;quot;/&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&amp;quot;net.sf.ehcache.configurationResourceName&amp;quot; value=&amp;quot;hibernate-ehcache.xml&amp;quot;/&amp;gt; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/properties&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/persistence-unit&amp;gt;
&lt;br&gt;&amp;lt;/persistence&amp;gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;If you need more information, please let me know. Any hints are welcome...
&lt;br&gt;&lt;br&gt;best regards
&lt;br&gt;Mark
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/JPA---Hibernate%3A-Does-a-Query-not-return-a-proxy-collection---tp25937933p25937933.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25803004</id>
	<title>Re: Strategy for history tables</title>
	<published>2009-10-08T07:05:07Z</published>
	<updated>2009-10-08T07:05:07Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">If you use EclipseLink there is history support as you have described.
&lt;br&gt;&lt;br&gt;You can use a DescriptorCustomizer to enable history on a ClassDescriptor.
&lt;br&gt;&lt;br&gt;See,
&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/api/1.1.1/org/eclipse/persistence/history/HistoryPolicy.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.eclipse.org/eclipselink/api/1.1.1/org/eclipse/persistence/history/HistoryPolicy.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://wiki.eclipse.org/Configuring_a_Descriptor_(ELUG)#Configuring_a_History_Policy&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://wiki.eclipse.org/Configuring_a_Descriptor_(ELUG)#Configuring_a_History_Policy&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Strategy-for-history-tables-tp25796959p25803004.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25796959</id>
	<title>Strategy for history tables</title>
	<published>2009-10-07T18:00:45Z</published>
	<updated>2009-10-07T18:00:45Z</updated>
	<author>
		<name>JeffTalley</name>
	</author>
	<content type="html">Is there a good strategy to deal with history/journal tables with JPA. For example, say I have a table named PERSON that has the fields: ID, VERSION, FIRST_NAME, LAST_NAME with a primary key of ID. Any time that the value of FIRST_NAME or LAST_NAME changes, I would like a new entry to be made in another table named PERSON_HIST that has the exact same columns except that ID and VERSION are a composite primary key (this is quite often done with a DB trigger). There could even be additional columns in the history table to track timestamps or user ID's of who made the change. I would like to have a class named Person that maps to PERSON and a subclass of Person named PersonHistory that maps to PERSON_HIST. If I create this hierarchy and do the mapping, JPA wants to persist the inheritance which is not what I want (I want them to be treated as separate entities). When these tables get to be 15+ columns in size, it is a pain to create two nearly identical classes and try to keep them in sync has development progresses. Any ideas?</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Strategy-for-history-tables-tp25796959p25796959.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25669416</id>
	<title>Re: 1-1 uni-directional mapping; possible with owner not holding foreign keys?</title>
	<published>2009-09-29T12:32:11Z</published>
	<updated>2009-09-29T12:32:11Z</updated>
	<author>
		<name>Ernie Rael</name>
	</author>
	<content type="html">While checking out the link you provided, I ran into the solution. I neglected to mention I am using JPA 2.0 (eclipselink). JPA 2.0 has added stuff to deal with the problems in JPA 1.0; in the 2.0 spec see: 2.4.1 Primary Keys Corresponding to Derived Identities.
&lt;br&gt;&lt;br&gt;Unfortunately, the implementation is incomplete. I went to file a bug, but one was filed for this issue only a couple days ago.
&lt;br&gt;&lt;br&gt;Thanks again.</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/1-1-uni-directional-mapping--possible-with-owner-not-holding-foreign-keys--tp25658335p25669416.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25664456</id>
	<title>Re: 1-1 uni-directional mapping; possible with owner not holding foreign keys?</title>
	<published>2009-09-29T07:45:01Z</published>
	<updated>2009-09-29T07:45:01Z</updated>
	<author>
		<name>Ernie Rael</name>
	</author>
	<content type="html">&amp;gt; Your mappings seem confused, I'm not sure how you can have a OneToOne
&lt;br&gt;&amp;gt; and a OneToMany using the same mappedBy.
&lt;br&gt;&lt;br&gt;Both Aspectgroup and Aspectdisplay have a field chartEvent, notice in ERD they each refer back to ChartEvent through a primary/foreign key; The mappings seem to work, though possibly sub-optimal and confusing.
&lt;br&gt;&lt;br&gt;&amp;gt; There is some info on cascaded primary keys which you seem to have which may be of some use,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence/OneToOne#Target_Foreign_Keys.2C_Primary_Key_Join_Columns.2C_Cascade_Primary_Keys&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://en.wikibooks.org/wiki/Java_Persistence/OneToOne#Target_Foreign_Keys.2C_Primary_Key_Join_Columns.2C_Cascade_Primary_Keys&lt;/a&gt;&lt;br&gt;&lt;br&gt;Doh! I missed that in the early chapters of the 2.0 spec. Thanks very much for the pointer.
&lt;br&gt;&lt;br&gt;&amp;gt; Personally, I would recommend avoiding the complexity of composite primary keys 
&lt;br&gt;&amp;gt; and just generated an id for each class/table. &amp;nbsp;This would most likely make things much simpler.
&lt;br&gt;&lt;br&gt;So are you suggesting that the join table ChartEvent have a unique/auto-gen field and that the other tables refer to that?
&lt;br&gt;&lt;br&gt;I considered that and then considered that there are lots of ChartEvent and relatively few rows of the other tables hanging off it (used only by the apps when the defaults don't satisfy). Being a novice, I have little feel for the tradeoffs in design complexity and db size. I'll take another look.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/1-1-uni-directional-mapping--possible-with-owner-not-holding-foreign-keys--tp25658335p25664456.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25663653</id>
	<title>Re: 1-1 uni-directional mapping; possible with owner not holding foreign keys?</title>
	<published>2009-09-29T07:03:30Z</published>
	<updated>2009-09-29T07:03:30Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">Your mappings seem confused, I'm not sure how you can have a OneToOne and a OneToMany using the same mappedBy.
&lt;br&gt;&lt;br&gt;There is some info on cascaded primary keys which you seem to have which may be of some use,
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence/OneToOne#Target_Foreign_Keys.2C_Primary_Key_Join_Columns.2C_Cascade_Primary_Keys&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://en.wikibooks.org/wiki/Java_Persistence/OneToOne#Target_Foreign_Keys.2C_Primary_Key_Join_Columns.2C_Cascade_Primary_Keys&lt;/a&gt;&lt;br&gt;&lt;br&gt;Personally, I would recommend avoiding the complexity of composite primary keys and just generated an id for each class/table. &amp;nbsp;This would most likely make things much simpler.&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/1-1-uni-directional-mapping--possible-with-owner-not-holding-foreign-keys--tp25658335p25663653.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25658335</id>
	<title>1-1 uni-directional mapping; possible with owner not holding foreign keys?</title>
	<published>2009-09-29T00:40:43Z</published>
	<updated>2009-09-29T00:40:43Z</updated>
	<author>
		<name>Ernie Rael</name>
	</author>
	<content type="html">Refer to the attached ER diagram
&lt;br&gt;&lt;img src=&quot;http://old.nabble.com/file/p25658335/000096.png&quot; border=&quot;0&quot; /&gt;&lt;br&gt;(the actual diagram has several tables hanging off ChartEvent) or the @Entity below. Current to add something to aspectDisplay table do:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; void putAspectdisplayData(ChartEvent ce, Set&amp;lt;AspectId&amp;gt; data) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Aspectdisplay ad = new Aspectdisplay();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ad.setChevPK(ce.getChevPK());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ad.setChartEvent(ce);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ad.setDat(new AspectdisplayData(add03));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; em.persist(ad);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; doCommit();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ce.setAspectdisplay(ad);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;I thought there might be a way to redefine the mappings so that the owner of the relationship is ChartEvent and make the relationship uni-directional (Aspectdisplay does not need a reference to ChartEvent). &amp;nbsp;Ideally, it could be specified so that the add looks like
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; void putAspectdisplayData(ChartEvent ce, Set&amp;lt;AspectId&amp;gt; data) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Aspectdisplay ad = new Aspectdisplay();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ad.setDat(new AspectdisplayData(add03));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ce.setAspectdisplay(ad);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; em.persist(ce); // not really needed assuming ce in persistence context
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; doCommit();
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;Note that the primary key is not being set, it seems there's enough info around so the persistence layer could assign it. I tried a variety of things to make ChartEvent the relationship owner, usually involving specifying @JoinColumns and/or @JoinTable; most attempts failed with &amp;quot;Multiple writable mappings exist for the field&amp;quot; exception, except when I used a 'table=&amp;quot;ASPECTDISPLAY&amp;quot;', then I got something about the ASPECTDISPLAY not being in the Entity, maybe it thought this was a secondary table. Is it possible to make ChartEvent the owner of a uni-directional 1-1? If the owner *must* be the holder of the foreign key, then out of luck. Is there some mapping that doesn't care about foreign keys that just does the join?
&lt;br&gt;&lt;br&gt;Curiously, while keeping Aspectdisplay the owner, putting &amp;quot;ad.setChevPK(ce.getChevPK())&amp;quot; into the second put method and using it updates the database even though ChartEvent is the inverse side. But the spec, 3.2.4, says
&lt;br&gt;&amp;nbsp; &amp;nbsp; Bidirectional relationships between managed entities will be persisted based on
&lt;br&gt;&amp;nbsp; &amp;nbsp; references held by the owning side of the relationship.
&lt;br&gt;so I guess this is non-portable (and a spec violation). Is something like this worth filing a bug report?
&lt;br&gt;&lt;br&gt;&lt;br&gt;@Entity
&lt;br&gt;@Table(name = &amp;quot;CHART_EVENT&amp;quot;, catalog = &amp;quot;&amp;quot;, schema = &amp;quot;ERNIE&amp;quot;)
&lt;br&gt;public class ChartEvent implements Serializable {
&lt;br&gt;&amp;nbsp; &amp;nbsp; private static final long serialVersionUID = 1L;
&lt;br&gt;&amp;nbsp; &amp;nbsp; @EmbeddedId
&lt;br&gt;&amp;nbsp; &amp;nbsp; protected ChevPK chevPK;
&lt;br&gt;&amp;nbsp; &amp;nbsp; @OneToOne(mappedBy = &amp;quot;chartEvent&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; private Aspectdisplay aspectdisplay;
&lt;br&gt;&amp;nbsp; &amp;nbsp; @OneToMany(mappedBy = &amp;quot;chartEvent&amp;quot;, orphanRemoval=true)
&lt;br&gt;&amp;nbsp; &amp;nbsp; private Collection&amp;lt;Aspectgroup&amp;gt; aspectgroupCollection;
&lt;br&gt;&lt;br&gt;@Entity
&lt;br&gt;@Table(name = &amp;quot;ASPECTDISPLAY&amp;quot;, catalog = &amp;quot;&amp;quot;, schema = &amp;quot;ERNIE&amp;quot;)
&lt;br&gt;public class Aspectdisplay implements Serializable {
&lt;br&gt;&amp;nbsp; &amp;nbsp; private static final long serialVersionUID = 1L;
&lt;br&gt;&amp;nbsp; &amp;nbsp; @EmbeddedId
&lt;br&gt;&amp;nbsp; &amp;nbsp; protected ChevPK chevPK;
&lt;br&gt;&amp;nbsp; &amp;nbsp; @Basic(optional = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; @Lob
&lt;br&gt;&amp;nbsp; &amp;nbsp; @Column(name = &amp;quot;DAT&amp;quot;, nullable = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; private AspectdisplayData dat;
&lt;br&gt;&amp;nbsp; &amp;nbsp; @JoinColumns({
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name = &amp;quot;CHART_ID&amp;quot;, referencedColumnName = &amp;quot;CHART_ID&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nullable = false, insertable = false, updatable = false),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name = &amp;quot;EVENT_ID&amp;quot;, referencedColumnName = &amp;quot;EVENT_ID&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nullable = false, insertable = false, updatable = false)})
&lt;br&gt;&amp;nbsp; &amp;nbsp; @OneToOne(optional = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; private ChartEvent chartEvent;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/1-1-uni-directional-mapping--possible-with-owner-not-holding-foreign-keys--tp25658335p25658335.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25656096</id>
	<title>Re: orphanRemoval with &quot;on delete cascade&quot;; also handling an overlapping mapping</title>
	<published>2009-09-28T19:39:09Z</published>
	<updated>2009-09-28T19:39:09Z</updated>
	<author>
		<name>Ernie Rael</name>
	</author>
	<content type="html">Thanks for the comments.
&lt;br&gt;&lt;br&gt;&amp;gt; For using delete cascade in the database you could,
&lt;br&gt;&amp;gt; - Remove the orphanRemoval=true, since you are deleting it on the database,
&lt;br&gt;&lt;br&gt;The problem with getting rid of the orphanRemoval=true is that the perstence context and 2nd level cache are out of sync with the DB. &amp;nbsp;Manually evicting stuff from the cache is a hassle.
&lt;br&gt;&lt;br&gt;&amp;gt; - Or, remove the delete cascade on the database, as you have orphanRemoval=true,
&lt;br&gt;&lt;br&gt;I guess I have an emotional attachment to the database constraints :-)
&lt;br&gt;&lt;br&gt;&amp;gt; - Or, live with the duplicate deletion.
&lt;br&gt;&lt;br&gt;It's not a performance thing in this case, but the issue could arise elsewhere at some point.
&lt;br&gt;&lt;br&gt;&amp;gt; You may also wish to log an bug/ehancement request for EclipseLink to have some enhanced support for this.
&lt;br&gt;&lt;br&gt;I'll do that.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; I'm not sure I understand you second issue. &amp;nbsp;You seem to have mapped the m-m join table as an 
&lt;br&gt;&amp;gt; Entity ChartEvent, but also defined a m-m for it.
&lt;br&gt;&lt;br&gt;Yes, that what I've got now.
&lt;br&gt;&lt;br&gt;&amp;gt; I would recommend not doing both, only mapping the 1-m to the ChartEvent object, as you can then 
&lt;br&gt;&amp;gt; access the event from the join object.
&lt;br&gt;&amp;gt; You can join-fetch or batch-read the event if efficiency is your concern.
&lt;br&gt;&lt;br&gt;I guess I really like the idea of adding an Event to a Chart, persisting the chart and having things done in the right order and the join table updated, for example logging shows:
&lt;br&gt;&amp;nbsp; &amp;nbsp; [EL Fine]: Connection(11616335)--INSERT INTO ERNIE.CHART (NAME) VALUES (?) bind =&amp;gt; [Narrow Orb]
&lt;br&gt;&amp;nbsp; &amp;nbsp; [EL Fine]: Connection(11616335)--values IDENTITY_VAL_LOCAL()
&lt;br&gt;&amp;nbsp; &amp;nbsp; [EL Fine]: Connection(11616335)--INSERT INTO CHART_EVENT (EVENT_ID, Chart_ID) VALUES (?, ?) bind =&amp;gt; [907, 2287]
&lt;br&gt;then em.find the created ChartEvent and add it to the chartEventcollection or simply do chart.refresh(). The other way around seems slightly more complex in java code.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; You could also make the m-m read-only in EclipseLink using a DescriptorCustomizer 
&lt;br&gt;&amp;gt; set the ClassDescriptor mapping to be readOnly.
&lt;br&gt;Jeez, something else to learn ;) Thanks for the pointer, I'll have to check this stuff out. I'd be inclined to make the 1-m to ChartEvent readonly. I'm a novice, is there some reason to do it the other way around?
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/orphanRemoval-with-%22on-delete-cascade%22--also-handling-an-overlapping-mapping-tp25640994p25656096.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25645180</id>
	<title>Re: orphanRemoval with &quot;on delete cascade&quot;; also handling an overlapping mapping</title>
	<published>2009-09-28T06:28:48Z</published>
	<updated>2009-09-28T06:28:48Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">For using delete cascade in the database you could,
&lt;br&gt;- Remove the orphanRemoval=true, since you are deleting it on the database,
&lt;br&gt;- Or, remove the delete cascade on the database, as you have orphanRemoval=true,
&lt;br&gt;- Or, live with the duplicate deletion.
&lt;br&gt;&lt;br&gt;You may also wish to log an bug/ehancement request for EclipseLink to have some enhanced support for this.
&lt;br&gt;&lt;br&gt;&lt;br&gt;I'm not sure I understand you second issue. &amp;nbsp;You seem to have mapped the m-m join table as an Entity ChartEvent, but also defined a m-m for it. &amp;nbsp;I would recommend not doing both, only mapping the 1-m to the ChartEvent object, as you can then access the event from the join object. &amp;nbsp;You can join-fetch or batch-read the event if efficiency is your concern.
&lt;br&gt;&lt;br&gt;You could also make the m-m read-only in EclipseLink using a DescriptorCustomizer set the ClassDescriptor mapping to be readOnly.
&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/orphanRemoval-with-%22on-delete-cascade%22--also-handling-an-overlapping-mapping-tp25640994p25645180.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25640994</id>
	<title>orphanRemoval with &quot;on delete cascade&quot;; also handling an overlapping mapping</title>
	<published>2009-09-27T23:05:39Z</published>
	<updated>2009-09-27T23:05:39Z</updated>
	<author>
		<name>Ernie Rael</name>
	</author>
	<content type="html">Given table A with primary key ID, and table B with A_ID FOREIGN KEY(A_ID) REFERENCES A(ID) ON DELETE CASCADE. And
&lt;br&gt;&amp;nbsp; &amp;nbsp; @Entity
&lt;br&gt;&amp;nbsp; &amp;nbsp; public class A {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @OneToOne(orphanRemoval=true)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private B b;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;When I do
&lt;br&gt;&amp;nbsp; &amp;nbsp; A.setB(null);
&lt;br&gt;&amp;nbsp; &amp;nbsp; commit();
&lt;br&gt;There is a &amp;quot;DELETE FROM B WHERE A_ID = ?&amp;quot; sent to the database, though this is not needed because of the constraint with on delete cascade. Is there anyway to get rid of the extraneous delete? In the spec, around the end of 2.9, it says
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; The persistence provider handles the object/relational mapping of the 
&lt;br&gt;&amp;nbsp; &amp;nbsp; relationships, including their loading and storing to the database as 
&lt;br&gt;&amp;nbsp; &amp;nbsp; specified in the metadata of the entity class, and the referential 
&lt;br&gt;&amp;nbsp; &amp;nbsp; integrity of the relationships as specified in the database (e.g., by 
&lt;br&gt;&amp;nbsp; &amp;nbsp; foreign key constraints).
&lt;br&gt;&lt;br&gt;which could be interpreted to mean that the provider does not have to send the delete statement. I'm using eclipselink-2.0 M7.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Another question, loosely related. I've got two tables/entities CHART and EVENT which are in an n:m relationship; each table has a primary key ID. The join table is CHART_EVENT with CHART_ID and EVENT_ID. There are also several tables/entities that have &amp;quot;@EmbeddedId ChevPK chevPK&amp;quot; where ChevPK references CHART_EVENT with EVENT_ID. For example Aspectdisplay below. The Chart entity maps both the the join table and the m:n relationship. Note that the remove method removes from both mapped collections; this works, but there are two DELETE statements sent to the database, anyway to prevent this? Conceptually I'm not sure what to right thing to do with the addEvent method; currently I add the event to the m:n, which assigns keys and add to the join table, and then do a em.refresh(chart), anything better to do?
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Entity
&lt;br&gt;&amp;nbsp; &amp;nbsp; @Table(name = &amp;quot;CHART&amp;quot;, catalog = &amp;quot;&amp;quot;, schema = &amp;quot;ERNIE&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; public class Chart implements Serializable {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static final long serialVersionUID = 1L;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Id
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @GeneratedValue(strategy = GenerationType.IDENTITY)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Basic(optional = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Column(name = &amp;quot;ID&amp;quot;, nullable = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Integer id;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @OneToMany(mappedBy = &amp;quot;chart&amp;quot;, orphanRemoval=true)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Collection&amp;lt;ChartEvent&amp;gt; chartEventCollection;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @ManyToMany
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinTable(name = &amp;quot;CHART_EVENT&amp;quot; ,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inverseJoinColumns = {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name = &amp;quot;EVENT_ID&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; referencedColumnName = &amp;quot;ID&amp;quot;, nullable = false)})
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Collection&amp;lt;Event&amp;gt; eventCollection;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; boolean addEvent(Event e) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return getEventCollection().add(e);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; boolean removeEvent(Event e) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChartEvent ce = new ChartEvent(getId(), e.getId());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; getChartEventCollection().remove(ce);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return getEventCollection().remove(e);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; @Entity
&lt;br&gt;&amp;nbsp; &amp;nbsp; @Table(name = &amp;quot;ASPECTDISPLAY&amp;quot;, catalog = &amp;quot;&amp;quot;, schema = &amp;quot;ERNIE&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; public class Aspectdisplay implements Serializable {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static final long serialVersionUID = 1L;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @EmbeddedId
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; protected ChevPK chevPK;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Basic(optional = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Lob
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Column(name = &amp;quot;DAT&amp;quot;, nullable = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private AspectdisplayData dat;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @OneToOne(optional = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumns({
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name = &amp;quot;CHART_ID&amp;quot;, referencedColumnName = &amp;quot;CHART_ID&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nullable = false, insertable = false, updatable = false),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name = &amp;quot;EVENT_ID&amp;quot;, referencedColumnName = &amp;quot;EVENT_ID&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nullable = false, insertable = false, updatable = false)})
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private ChartEvent chartEvent;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/orphanRemoval-with-%22on-delete-cascade%22--also-handling-an-overlapping-mapping-tp25640994p25640994.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25573947</id>
	<title>Re: how to determine &quot;other&quot; when &quot;Only one may be defined as writable&quot;</title>
	<published>2009-09-24T07:49:10Z</published>
	<updated>2009-09-24T07:49:10Z</updated>
	<author>
		<name>Ernie Rael</name>
	</author>
	<content type="html">&amp;gt; error means you have another Basic or OneToOne mapping the same column.
&lt;br&gt;&lt;br&gt;OK. I was hoping there is/was some way to turn on other logging/degug info (I'm using JPA-2.0-M7 eclipselink, I tried LogLevel.FINEST). I'm sure this won't be that last time I'd like to disect things, and this seems a simple example to start with. I'll take a more careful look and include the mappings if I'm stuck. Thanks.
&lt;br&gt;&lt;br&gt;I'm new to JPA (DB as well, but that's another issue) and I want to get a good feeling for what's going on.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/how-to-determine-%22other%22-when-%22Only-one-may-be-defined-as-writable%22-tp25531388p25573947.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25571478</id>
	<title>Re: how to determine &quot;other&quot; when &quot;Only one may be defined as writable&quot;</title>
	<published>2009-09-24T07:16:17Z</published>
	<updated>2009-09-24T07:16:17Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">The error means you have another Basic or OneToOne mapping the same column. &amp;nbsp;Please include you mappings (annotations).
&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/how-to-determine-%22other%22-when-%22Only-one-may-be-defined-as-writable%22-tp25531388p25571478.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25531388</id>
	<title>how to determine &quot;other&quot; when &quot;Only one may be defined as writable&quot;</title>
	<published>2009-09-23T22:10:09Z</published>
	<updated>2009-09-23T22:10:09Z</updated>
	<author>
		<name>Ernie Rael</name>
	</author>
	<content type="html">I added
&lt;br&gt;&amp;nbsp; &amp;nbsp; @OneToOne
&lt;br&gt;&amp;nbsp; &amp;nbsp; private Event event;
&lt;br&gt;to an Enity and got
&lt;br&gt;&amp;nbsp; &amp;nbsp; Exception [EclipseLink-48] (Eclipse Persistence Services - 2.0.0.v20090821-r4934): org.eclipse.persistence.exceptions.DescriptorException
&lt;br&gt;&amp;nbsp; &amp;nbsp; Exception Description: Multiple writable mappings exist for the field [ERNIE.ASPECTGROUP.EVENT_ID]. &amp;nbsp;Only one may be defined as writable, all others must be specified read-only.
&lt;br&gt;&amp;nbsp; &amp;nbsp; Mapping: org.eclipse.persistence.mappings.OneToOneMapping[event]
&lt;br&gt;&amp;nbsp; &amp;nbsp; Descriptor: RelationalDescriptor(org.metawb.astro.db.Aspectgroup --&amp;gt; [DatabaseTable(ERNIE.ASPECTGROUP)])
&lt;br&gt;&lt;br&gt;adding
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn( nullable = false, insertable = false, updatable = false)
&lt;br&gt;fixed the problem of course. But I'd like to know what &amp;quot;other&amp;quot; mapping has this field as writable. I turned on logging but I didn't see anything obvious. Is there a way to get this info. I took a look at the Metamodel API but gave up when I saw:
&lt;br&gt;&amp;nbsp; &amp;nbsp; The metamodel API may be extended to cover object/relational mapping
&lt;br&gt;&amp;nbsp; &amp;nbsp; information in a future release of this specification.
&lt;br&gt;&lt;br&gt;-ernie</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/how-to-determine-%22other%22-when-%22Only-one-may-be-defined-as-writable%22-tp25531388p25531388.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25436922</id>
	<title>Re: Foreing key using JPA</title>
	<published>2009-09-14T07:34:30Z</published>
	<updated>2009-09-14T07:34:30Z</updated>
	<author>
		<name>James Sutherland</name>
	</author>
	<content type="html">See,
&lt;br&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence/ManyToOne&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://en.wikibooks.org/wiki/Java_Persistence/ManyToOne&lt;/a&gt;&lt;br&gt;&lt;br&gt;Otherwise, include some specific information such as the exception and stack, SQL, model, code, etc.
&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;&lt;a href=&quot;http://wiki.eclipse.org/User:James.sutherland.oracle.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;James Sutherland&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.eclipse.org/eclipselink/
&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Wiki: &lt;a href=&quot;http://wiki.eclipse.org/EclipseLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;EclipseLink&lt;/a&gt;, &lt;a href=&quot;http://wiki.oracle.com/page/TopLink&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;&lt;br&gt;Forums: &lt;a href=&quot;http://forums.oracle.com/forums/forum.jspa?forumID=48&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TopLink&lt;/a&gt;, &lt;a href=&quot;http://www.nabble.com/EclipseLink-f26430.html&quot; target=&quot;_top&quot;&gt;EclipseLink&lt;/a&gt;&lt;br&gt;Book: &lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Java Persistence&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Foreing-key-using-JPA-tp25400702p25436922.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25434501</id>
	<title>autoFlush problem in JPA with spring</title>
	<published>2009-09-14T04:54:35Z</published>
	<updated>2009-09-14T04:54:35Z</updated>
	<author>
		<name>black_hawk</name>
	</author>
	<content type="html">I'm trying to populate a list inside an object from form ,when i press save i first start to validate the list values in my controller then return to next page if validation return true or back to the same page if validation return false,but also the code flow is ok and it return back to the same page when it false with error message it's persist the wrong values by it self.
&lt;br&gt;I'm using jpa,spring MVC,i think it's autoFlush situation but how to configure the jpa flush mode using spring
&lt;br&gt;thanks in regards,,,,</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/autoFlush-problem-in-JPA-with-spring-tp25434501p25434501.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25434194</id>
	<title>Problem on saving/deleting entities</title>
	<published>2009-09-14T04:29:41Z</published>
	<updated>2009-09-14T04:29:41Z</updated>
	<author>
		<name>bogdannb</name>
	</author>
	<content type="html">I have the following jpa class :
&lt;br&gt;&lt;br&gt;/**
&lt;br&gt;&amp;nbsp;* 
&lt;br&gt;&amp;nbsp;*/
&lt;br&gt;package ro.spad.web.registrucasa.client.model;
&lt;br&gt;&lt;br&gt;import java.io.Serializable;
&lt;br&gt;import java.util.Date;
&lt;br&gt;import java.util.List;
&lt;br&gt;&lt;br&gt;import javax.persistence.CascadeType;
&lt;br&gt;import javax.persistence.Column;
&lt;br&gt;import javax.persistence.Entity;
&lt;br&gt;import javax.persistence.FetchType;
&lt;br&gt;import javax.persistence.GeneratedValue;
&lt;br&gt;import javax.persistence.GenerationType;
&lt;br&gt;import javax.persistence.Id;
&lt;br&gt;import javax.persistence.JoinColumn;
&lt;br&gt;import javax.persistence.JoinTable;
&lt;br&gt;import javax.persistence.OneToMany;
&lt;br&gt;import javax.persistence.OneToOne;
&lt;br&gt;import javax.persistence.Table;
&lt;br&gt;&lt;br&gt;import com.google.gwt.user.client.rpc.IsSerializable;
&lt;br&gt;&lt;br&gt;/**
&lt;br&gt;&amp;nbsp;* @author vp@spad.ro
&lt;br&gt;&amp;nbsp;*
&lt;br&gt;&amp;nbsp;*/
&lt;br&gt;&lt;br&gt;@Entity
&lt;br&gt;@Table(name = &amp;quot;registrudecasa&amp;quot;)
&lt;br&gt;public class RegistruDeCasa implements Serializable, IsSerializable {
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private int myid;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Date data;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private List&amp;lt;LinieRegistru&amp;gt; liniiRegistru;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private PunctDeLucru punctDeLucru;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private User userBasic;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private User userExpert;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Id @GeneratedValue(strategy=GenerationType.AUTO)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public int getMyid() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return myid;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setMyid(int myid) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.myid = myid;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Column (length = 100, nullable = false)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setData(Date data) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.data = data;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Date getData() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return data;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @OneToMany (fetch = FetchType.LAZY)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinTable(name = &amp;quot;registrudecasa_linieregistru&amp;quot;, joinColumns = @JoinColumn(name = &amp;quot;registrudecasa_myid&amp;quot;), inverseJoinColumns = @JoinColumn(name = &amp;quot;linieregistru_myid&amp;quot;))
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public List&amp;lt;LinieRegistru&amp;gt; getLiniiRegistru() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return liniiRegistru;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setLiniiRegistru(List&amp;lt;LinieRegistru&amp;gt; liniiRegistru) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.liniiRegistru = liniiRegistru;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @OneToOne (cascade = CascadeType.ALL)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;PUNCTDELUCRU_MYID&amp;quot;, &amp;nbsp;nullable = true, insertable = true, updatable = true)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public PunctDeLucru getPunctDeLucru() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return punctDeLucru;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setPunctDeLucru(PunctDeLucru punctDeLucru) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.punctDeLucru = punctDeLucru;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @OneToOne (cascade = CascadeType.ALL)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;USER_BASIC_MYID&amp;quot;, nullable = false, insertable = true, updatable = true)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public User getUserBasic() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return userBasic;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setUserBasic(User userBasic) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.userBasic = userBasic;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @OneToOne (cascade = CascadeType.ALL)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @JoinColumn(name=&amp;quot;USER_EXPERT_MYID&amp;quot;, nullable = true, insertable = true, updatable = true)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public User getUserExpert() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return userExpert;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setUserExpert(User userExpert) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.userExpert = userExpert;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;br&gt;I'm having a problem when saving or deleting an entity &amp;quot;RegistruDeCasa&amp;quot;. The problem is that this entity has a reference to an entity called userExpert(class : User) and when I'm trying to save or delete a &amp;quot;RegistruDeCasa&amp;quot; my application tryes also to update or delete the expertUser. Is this a matter of JPA and annotations? I'm not very sure .... maybe it's something regarding Hibernate (my application also uses Hibernate) but I don't know for sure......Can somebody help me? This problem also persist whenever I &amp;nbsp;try to save an entity that has one to one relations to another entity( for example in this class : punctDeLucru,userBasic,userExpert).
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Thanks in advance,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Bogdannb</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-on-saving-deleting-entities-tp25434194p25434194.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25427872</id>
	<title>Re: Multilevel Inheritance</title>
	<published>2009-09-13T15:20:43Z</published>
	<updated>2009-09-13T15:20:43Z</updated>
	<author>
		<name>juaninf</name>
	</author>
	<content type="html">help please</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Multilevel-Inheritance-tp25322970p25427872.html" />
</entry>

</feed>
