-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Ternary Mapping with XDoclet
PostPosted: Sun Nov 02, 2003 7:14 pm 
Beginner
Beginner

Joined: Wed Oct 15, 2003 3:08 pm
Posts: 32
I am trying to set up a ternary map between two domain objects and a UserType that represents the value of the link. I foudn the following post useful: http://forum.hibernate.org/viewtopic.ph ... ht=ternary.

I am trying to get this working with XDoclet tags, but I am not able to get the resulting .hbm.xml to look quite like what Steve has. Here is one example of my tags:

Code:
    /**
     * @hibernate.map table="resource_state_on_system"
     * @hibernate.collection-key column="resource_id"
     * @hibernate.collection-many-to-many column="resource_id" class="Resource"
     * @hibernate.collection-element column="state" type="StateType" length="20"
     */


I can't seem to figure out how to get the index-many-to-many tag with XDoclet. I think this is why I am getting an NPE with the following trace:

Code:
java.lang.NullPointerException
        at net.sf.hibernate.cfg.Binder.bindMapSecondPass(Binder.java:995)
        at net.sf.hibernate.cfg.Binder$MapSecondPass.secondPass(Binder.java:1177)
        at net.sf.hibernate.cfg.Binder$SecondPass.doSecondPass(Binder.java:1135)

        at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:497)
        at net.sf.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:352)
        at net.sf.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:51)
        at org.apache.maven.hibernate.beans.SchemaExportBean.getSchemaExport(SchemaExportBean.java:358)
        at org.apache.maven.hibernate.beans.SchemaExportBean.execute(SchemaExportBean.java:268)


I did try using the @hibernate.collection-index tag, but it seems to need a type, but I am using a domain object class and not a type.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 02, 2003 7:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Its better if you show the actual Hibernate mapping that you couldn't make work. Don't show just the xdoclet tags.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 02, 2003 10:13 pm 
Beginner
Beginner

Joined: Wed Oct 15, 2003 3:08 pm
Posts: 32
Here is my hibernate mapping file:

Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class
        name="Resource"
        table="resource"
        dynamic-update="false"
        dynamic-insert="false"
    >

        <id
            name="id"
            column="id"
            type="java.lang.String"
        >
            <generator class="uuid.hex">
            </generator>
        </id>

        <property
            name="state"
            type="StateType"
            update="true"
            insert="true"
            column="state"
            length="20"
        />


        <map
            name="systemStateMap"
            table="resource_state_on_system"
            lazy="false"
            sort="unsorted"
            inverse="false"
            cascade="none"
        >

              <key
                  column="resource_id"
              />

              <element
                  column="state"
                  type="StateType"
                  length="20"
                  not-null="false"
                  unique="false"
              />

              <many-to-many
                  class="System"
                  column="system_id"
                  outer-join="auto"
              />

        </map>

        <property
            name="displayName"
            type="java.lang.String"
            update="true"
            insert="true"
            column="display_name"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Resource.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 02, 2003 10:26 pm 
Beginner
Beginner

Joined: Wed Oct 15, 2003 3:08 pm
Posts: 32
Could this be related? http://opensource.atlassian.com/project ... =printable. I have the latest XDoclet from CVS, so I will see if I can find some documentation for this.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 02, 2003 10:29 pm 
Beginner
Beginner

Joined: Wed Oct 15, 2003 3:08 pm
Posts: 32
I found the docs and there is a new tag @hibernate.index-many-to-many. This looks like what I was looking for.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.