Hello all.

I am trying to generate the following mapping:

<bag name="modulePieces" table="module_piece" cascade="all" lazy="true">
      <key column="id_module" />
      <composite-element class="ModulePiece">
        <many-to-many column="id_piece" class="com.mycompany.model.Piece />
        <property name="quantity"/>
      </composite-element>
    </bag>

I have tried the following xdoclet tags in my Module.java class, just before the getModulePieces() method:

/**
      *    @hibernate.bag cascade="all-delete-orphan" lazy="true" table=module_piece"
      * @hibernate.key column="id_module"
      * @hibernate.composite-element class="com.marcelovila.model.ModulePiece"
      * @hibernate.property column="quantity" type="int"
      * @hibernate.many-to-many column="id_piece" class="com.marcelovila.model.Piece" not-null="true"
      *    
      */

... and it doesn't work. It gives me this:

<property
            name="modulePieces"
                    type="int"
                    column="quantity"
        >
        </property>

        <bag
            name="modulePieces"
            lazy="true"
            cascade="all-delete-orphan"
        >
            <key
                column="id_module"
            >
            </key>         

            <many-to-many
                class="com.marcelovila.model.Piece"
                column="id_piece"
             >
             </many-to-many>

            <composite-element
                class="com.marcelovila.model.ModulePiece"
            >

            </composite-element>

        </bag>

... all messed up. "quantity" has become a property outside of the bag, the composite element is empty, the many-to-many is outside. On top of that, it doesn't even finish creating the hbm.xml file. I get a SaxParserException saying:

The content of element type "bag" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(element|one-to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,filter*)".] is not valid according to its DTD or XML Schema. This might be due to some missing tags in your source.>>

If I try it using hibernate.collection-composite-element, it doesn't even generate the composite element!

What the heck am I doing wrong here?

Thanks again,
Bob

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Reply via email to