You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by gopalbisht <bi...@rediffmail.com> on 2009/04/24 09:49:38 UTC

I am unable to create index of an object having composite key

Hi all,

I am using hibernate search with lucene. I need to create index of DomainTag
object  which have only one composite key. I am unware  how to define the
annotations for the composite key in DomainTag (pojo) class.
If any one can help , please help me. Thanks  in advance.

My DomainTag.hbm.xml file is as follows:
--------------------------------------****************************----------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
    
<hibernate-mapping>
<!-- 
    Created by the Middlegen Hibernate plugin 2.2

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class 
    name="com.test.manager.DomainTag" 
    table="domaintag" 
    >

    <composite-id>
	    <!-- Associations -->
	    <!-- derived association(s) for compound key -->
	    <!-- bi-directional many-to-one association to Item -->
	 <!-- Associations -->
	    <!-- derived association(s) for compound key -->
	    <!-- bi-directional many-to-one association to Item -->
	    <key-many-to-one
	        name="topic"
		    class="com.test.manager.DomainTest">
	    	<column name="domain_id" />
		</key-many-to-one>
		
	    <!-- bi-directional many-to-one association to Tag -->
	    <key-many-to-one
	        name="tag"
		    class="com.test.manager.Tag">
	    	<column name="tag_id" />
		</key-many-to-one>

	</composite-id>      

</class>
</hibernate-mapping>
--------------------------------------****************************----------------------------
-- 
View this message in context: http://www.nabble.com/I-am-unable-to-create-index-of-an-object-having-composite-key-tp23211575p23211575.html
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: I am unable to create index of an object having composite key

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
You'll do best to direct this question to the Hibernate group.  java- 
dev is for Lucene development so not an appropriate Lucene place to  
ask.  java-user would be better, but your question is more Hibernate  
specific.

	Erik


On Apr 24, 2009, at 3:49 AM, gopalbisht wrote:

>
> Hi all,
>
> I am using hibernate search with lucene. I need to create index of  
> DomainTag
> object  which have only one composite key. I am unware  how to  
> define the
> annotations for the composite key in DomainTag (pojo) class.
> If any one can help , please help me. Thanks  in advance.
>
> My DomainTag.hbm.xml file is as follows:
> -------------------------------------- 
> ****************************----------------------------
> <?xml version="1.0"?>
> <!DOCTYPE hibernate-mapping PUBLIC
>    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
>    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
>
> <hibernate-mapping>
> <!--
>    Created by the Middlegen Hibernate plugin 2.2
>
>    http://boss.bekk.no/boss/middlegen/
>    http://www.hibernate.org/
> -->
>
> <class
>    name="com.test.manager.DomainTag"
>    table="domaintag"
>>
>
>    <composite-id>
> 	    <!-- Associations -->
> 	    <!-- derived association(s) for compound key -->
> 	    <!-- bi-directional many-to-one association to Item -->
> 	 <!-- Associations -->
> 	    <!-- derived association(s) for compound key -->
> 	    <!-- bi-directional many-to-one association to Item -->
> 	    <key-many-to-one
> 	        name="topic"
> 		    class="com.test.manager.DomainTest">
> 	    	<column name="domain_id" />
> 		</key-many-to-one>
> 		
> 	    <!-- bi-directional many-to-one association to Tag -->
> 	    <key-many-to-one
> 	        name="tag"
> 		    class="com.test.manager.Tag">
> 	    	<column name="tag_id" />
> 		</key-many-to-one>
>
> 	</composite-id>
>
> </class>
> </hibernate-mapping>
> -------------------------------------- 
> ****************************----------------------------
> -- 
> View this message in context: http://www.nabble.com/I-am-unable-to-create-index-of-an-object-having-composite-key-tp23211575p23211575.html
> Sent from the Lucene - Java Developer mailing list archive at  
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org