<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Mapping Composite Keys in Hibernate</title>
	<atom:link href="http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/</link>
	<description>Find free mock and practice test, create and sell tests</description>
	<lastBuildDate>Fri, 03 Feb 2012 01:03:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Revathy</title>
		<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/comment-page-1/#comment-10489</link>
		<dc:creator>Revathy</dc:creator>
		<pubDate>Thu, 05 Jan 2012 09:03:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1682#comment-10489</guid>
		<description>Hi Sumita,
It is possible to declare generator tag in the composite id field for hibernate,.that is my table my 2 primary keys and i want one of those primary keys to be auto incremented.It si possible in hibernate if not what is the other way by which i can implement the composite primary keys and generator tag.?Please respond immediatley.Thanks a ton.</description>
		<content:encoded><![CDATA[<p>Hi Sumita,<br />
It is possible to declare generator tag in the composite id field for hibernate,.that is my table my 2 primary keys and i want one of those primary keys to be auto incremented.It si possible in hibernate if not what is the other way by which i can implement the composite primary keys and generator tag.?Please respond immediatley.Thanks a ton.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Disadvantages of Hibernate ? &#124; Free practice test , mock test, driving test, interview questions</title>
		<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/comment-page-1/#comment-10260</link>
		<dc:creator>Disadvantages of Hibernate ? &#124; Free practice test , mock test, driving test, interview questions</dc:creator>
		<pubDate>Wed, 15 Jun 2011 17:44:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1682#comment-10260</guid>
		<description>[...] 4.  Composite mapping is complex : If you do not understand it , yes it is complex . But this will not be a disadvantage. We have talked about this here mapping composite keys in hibernate. [...]</description>
		<content:encoded><![CDATA[<p>[...] 4.  Composite mapping is complex : If you do not understand it , yes it is complex . But this will not be a disadvantage. We have talked about this here mapping composite keys in hibernate. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: himanshu</title>
		<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/comment-page-1/#comment-10183</link>
		<dc:creator>himanshu</dc:creator>
		<pubDate>Sat, 14 May 2011 08:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1682#comment-10183</guid>
		<description>foreign key concept is not implemented</description>
		<content:encoded><![CDATA[<p>foreign key concept is not implemented</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bkrakesh</title>
		<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/comment-page-1/#comment-9465</link>
		<dc:creator>bkrakesh</dc:creator>
		<pubDate>Tue, 18 Jan 2011 05:05:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1682#comment-9465</guid>
		<description>I just saw one article , which explain implementation of composite primary key using annotation with simple example.
http://j2eereference.com/2011/01/implementing-composit-primary-key-with-jpa-and-hibernate/</description>
		<content:encoded><![CDATA[<p>I just saw one article , which explain implementation of composite primary key using annotation with simple example.<br />
<a href="http://j2eereference.com/2011/01/implementing-composit-primary-key-with-jpa-and-hibernate/" rel="nofollow">http://j2eereference.com/2011/01/implementing-composit-primary-key-with-jpa-and-hibernate/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sridevi Nanubala</title>
		<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/comment-page-1/#comment-1351</link>
		<dc:creator>Sridevi Nanubala</dc:creator>
		<pubDate>Mon, 01 Mar 2010 06:40:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1682#comment-1351</guid>
		<description>Hi Smitha,

It is very nice of you, that you have explained about composite-id in hibernate so clearly. 
Further to this, Could you please hint out , how to invoke the query and execute with HibernateTemplate.Find 
Eagerly looking for your comment.

Thanks in advance.
Sridevi.</description>
		<content:encoded><![CDATA[<p>Hi Smitha,</p>
<p>It is very nice of you, that you have explained about composite-id in hibernate so clearly.<br />
Further to this, Could you please hint out , how to invoke the query and execute with HibernateTemplate.Find<br />
Eagerly looking for your comment.</p>
<p>Thanks in advance.<br />
Sridevi.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Changsu Jiang</title>
		<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/comment-page-1/#comment-1335</link>
		<dc:creator>Changsu Jiang</dc:creator>
		<pubDate>Fri, 19 Feb 2010 18:05:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1682#comment-1335</guid>
		<description>@David M. Karr

regarding your question in the last paragraph, you just need to define the mapping to the object reference to be &quot;insertable=false, updatable=false&quot; if you use annotation.

for example:

public class PurchaseTest {
   private PurchaseTestId pk = new PurchaseTestId();
   private Customer customer;

   @EmbeddedId
   public PurchaseTestId getPk() {
      return this.pk; 
   }

   public void setPk(PurchaseTestId pk) {
      this.pk = pk; 
   }

   public Customer getCustomer() {
      return this.customer;
   }

   @ManyToOne
   @JoinColumn(name=&quot;CUSTOMER_ID&quot;, insertable=false, updatable=false)
   public void setCustomer(Customer customer) {
      this.customer = customer;
   }
}</description>
		<content:encoded><![CDATA[<p>@David M. Karr</p>
<p>regarding your question in the last paragraph, you just need to define the mapping to the object reference to be &#8220;insertable=false, updatable=false&#8221; if you use annotation.</p>
<p>for example:</p>
<p>public class PurchaseTest {<br />
   private PurchaseTestId pk = new PurchaseTestId();<br />
   private Customer customer;</p>
<p>   @EmbeddedId<br />
   public PurchaseTestId getPk() {<br />
      return this.pk;<br />
   }</p>
<p>   public void setPk(PurchaseTestId pk) {<br />
      this.pk = pk;<br />
   }</p>
<p>   public Customer getCustomer() {<br />
      return this.customer;<br />
   }</p>
<p>   @ManyToOne<br />
   @JoinColumn(name=&#8221;CUSTOMER_ID&#8221;, insertable=false, updatable=false)<br />
   public void setCustomer(Customer customer) {<br />
      this.customer = customer;<br />
   }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David M. Karr</title>
		<link>http://www.skill-guru.com/blog/2010/02/10/mapping-composite-keys-in-hibernate/comment-page-1/#comment-1334</link>
		<dc:creator>David M. Karr</dc:creator>
		<pubDate>Fri, 19 Feb 2010 17:11:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1682#comment-1334</guid>
		<description>One thing I&#039;ve noticed with both Hibernate and JPA is that when you map an entity with composite keys, it becomes awkward when one or more of those keys that make up the composite key could represent an object reference that could be navigated to, if it wasn&#039;t defined as a (boxed) primitive.

For instance, your &quot;PurchasedTestId&quot; class maps the PKs for &quot;customer&quot; and &quot;test&quot; with Long values, instead of something like &quot;Customer&quot; or &quot;Test&quot;.  If you had a need to navigate from that instance to the Customer or Test object, you couldn&#039;t do it directly.

I&#039;ve often wondered what would happen if you defined two properties in a class, one a boxed primitive used in the composite key, and the other a true object reference, and you mapped both of them in the mapping to the same column.  I think there&#039;s a possibility this could work when reading from the database, but I don&#039;t know what it would do when writing.</description>
		<content:encoded><![CDATA[<p>One thing I&#8217;ve noticed with both Hibernate and JPA is that when you map an entity with composite keys, it becomes awkward when one or more of those keys that make up the composite key could represent an object reference that could be navigated to, if it wasn&#8217;t defined as a (boxed) primitive.</p>
<p>For instance, your &#8220;PurchasedTestId&#8221; class maps the PKs for &#8220;customer&#8221; and &#8220;test&#8221; with Long values, instead of something like &#8220;Customer&#8221; or &#8220;Test&#8221;.  If you had a need to navigate from that instance to the Customer or Test object, you couldn&#8217;t do it directly.</p>
<p>I&#8217;ve often wondered what would happen if you defined two properties in a class, one a boxed primitive used in the composite key, and the other a true object reference, and you mapped both of them in the mapping to the same column.  I think there&#8217;s a possibility this could work when reading from the database, but I don&#8217;t know what it would do when writing.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

