-->
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.  [ 4 posts ] 
Author Message
 Post subject: SQL-INSERT
PostPosted: Fri Feb 04, 2005 1:35 pm 
Newbie

Joined: Thu Jan 13, 2005 11:48 am
Posts: 4
For my lookup table, I tried to create the hbm.xml file with sql-insert statements , but at the time of object creation , I get the error : Element "class" does not allow "sql-insert" here..

Why is this happening ? How can I insert data into lookup table at the time of table creation ?



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

<hibernate-mapping>

        <class name="Status" table="Status">
                <id name="StatusId" column="StatusId" type="long" >
                        <generator class="assigned"/>
                </id>               
                <property name="Description" column="Description" type="string"/>
                <set name="accounts" cascade="all" inverse="true" lazy="true">
               <key column="StatusId"/>
              <one-to-many class="MWAccounts"/>
                </set>
                <set name="orderItems" cascade="all" inverse="true" lazy="true">
               <key column="StatusId"/>
                <one-to-many class="MWOrderItems"/>
                </set>
            <set name="orders" cascade="all" inverse="true" lazy="true">
               <key column="StatusId"/>
                <one-to-many class="MWOrders"/>
                </set>
<sql-insert>insert into status (StatusId,Description) values(1,'Active')</sql-insert>
<sql-insert>insert into status (StatusId,Description) values(2,'Removed')</sql-insert>

         </class>

</hibernate-mapping>

_________________
Thanks,
Ritu


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 1:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
sql-insert does not at all do what you think. Please read the docs.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 8:49 pm 
Newbie

Joined: Thu Jan 13, 2005 11:48 am
Posts: 4
Is there any way to do it ?

_________________
Thanks,
Ritu


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 8:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Interceptor.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.