PlanetJava
Custom Search

java-xdoclet-user
[Top] [All Lists]

Hibernate key colmun problem

Subject: Hibernate key colmun problem
Date: Tue, 14 Jun 2005 11:57:04 -0300
I need to generate this hibernate tag:
        <map
            name="options"
            lazy="false"
            sort="natural"
            inverse="false"
            cascade="all"
        >
            <key
                column="fk_drawing" not-null="true"
            >
            </key>
            <index
                column="digit"
                type="java.lang.Integer"
            />
            <one-to-many
                  class="Option"
            />
        </map>
The most important is the not-null=?true? attribute in key node. But in
XDoclet I try to use this annotations:
 * @hibernate.map cascade="all" inverse="false" sort="natural"
 * @hibernate.collection-one-to-many class="Option"
 * @hibernate.collection-key column="fk_drawing"
 * @hibernate.collection-index column="digit" type="java.lang.Integer"
It generates almost tag but not-null=?true? attribute I couldn?t because
@hibernate.collection-key hasn?t a not-null attribute. If I do not put
this attribute hibernate tries to insert child first than parent and its
corrupt the database that doesn?t allow foreign-key null.
I try to change it to:
* @hibernate.collection-key 
* @hibernate.collection-key-column name="fk_drawing" not-null=?true?
But it generates this tag:
            <key
            >
                <column
                    name="fk_drawing" 
                    not-null="true"
                />
            </key>
And hibernate doesn?t allow it.
Have someone a solution to this case?
Flávio H Suguimoto Leite
Pragya Technologies Americas - Brazil
Ribeirão Preto - SP - Brazil
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy