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.  [ 2 posts ] 
Author Message
 Post subject: Delet operation through HSQL
PostPosted: Mon Oct 09, 2006 11:48 am 
Newbie

Joined: Wed Oct 04, 2006 3:28 pm
Posts: 6
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hi I am trying to delete all the records of Region. The mapping file is attached an also the Query through which I want to delet the records.

But Violation Exception is coming.

Read this: http://hibernate.org/42.html
[<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="kh.doc.ejb.impl.Region" table="REGION">
<composite-id>
<key-property name="id" column="REGION_ID"/>
<key-property name ="jobId" column ="J_ID"/>
</composite-id>
<property name ="entityState" column = "E_STATE"/>
<list name = "multiLanguageName" cascade="all">
<key>
<column name="REGION_ID"/>
<column name="J_ID"/>
</key>
<index column = "IND_COLUMN" type = "integer"/>
<composite-element class="kh.doc.ejb.impl.MultiLanguageName">
<property name ="longName" column ="LONG_NAME"/>
<property name ="shortName" column = "SHORT_NAME"/>
<property name ="languageId" column ="Language_ID"/>
</composite-element>
</list>
</class>
</hibernate-mapping>][ String deleteRegion = "delete Region b where b.jobId = :yentityState";
int x = mSession.createQuery(deleteRegion).setString("yentityState",jobId).executeUpdate();
][/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 6:01 pm 
Newbie

Joined: Wed Jul 12, 2006 11:30 am
Posts: 6
Please post the stack trace of the error. In the absense of that, I guess the error is not beacause of Hibernate but because of your data model. You are trying to delete a record that has children.

I suggest that you execute the same query in the database directly and see if you get the same exception.


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