-->
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.  [ 1 post ] 
Author Message
 Post subject: <dynamic-composite-element> ?
PostPosted: Tue Mar 17, 2009 6:30 am 
Newbie

Joined: Tue Aug 19, 2008 4:52 pm
Posts: 3
Is it possible to define a collection of dynamic components when running in dynamic-map mode?

I am running with:

<property name="hibernate.default_entity_mode">dynamic-map</property>

and am trying to work out how to set a collection of dynamic components.

With the following mapping file below the composite-element tag requires a class but hibernate does not accept java.util.Map as a class saying that it cannot introspect and find the setters:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

   <class entity-name="Pump" table="Pump"
      lazy="true">
      
      <tuplizer entity-mode="dynamic-map"
         class="org.hibernate.tuple.entity.MyCustomTuplizer" />
         
      <id name="id" type="long" column="ID">
         <generator class="native" />
      </id>
      
      <property name="serialNumber" type="string" />

      <set name="billOfMaterials" table="BillOfMaterials" lazy="true">
         <key column="id" />
         <composite-element class="java.util.Map">
            <property name="partName" />
            <property name="quantity" />
         </composite-element>
      </set>
   </class>
</hibernate-mapping>

I was looking for something like the following but clearly there is no such thing as <dynamic-composite-element>:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

   <class entity-name="Pump" table="Pump"
      lazy="true">
      
      <tuplizer entity-mode="dynamic-map"
         class="org.hibernate.tuple.entity.MyCustomTuplizer" />
         
      <id name="id" type="long" column="ID">
         <generator class="native" />
      </id>
      
      <property name="serialNumber" type="string" />

      <set name="billOfMaterials" table="BillOfMaterials" lazy="true">
         <dynamic-composite-element>
            <property name="partName" />
            <property name="quantity" />
         </dynamic-composite-element>
      </set>
   </class>
</hibernate-mapping>


Is there a way to have a collection of dynamic composite parts or do I have to turn the composite into a dynamic-map entity and set cascade to the relationship?

thx


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

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.