Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

advanced hibernate query issue

 
bob du
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have my pojo classes, hbm.xml files and my application runs fine. but on the console, the hibernate generated queries is doing some kind of loop or repeat of the queries.

console shows something like this (first 8 rows is fine, but after is where the repeats starts. i want to know why it is doing this and how do i fix this issue.) some info that may help, at the end of each hibernate queries are left inner joins and they have either one-to-one or one-to-many mappings (this code was written using hibernate 2.0)

Hibernate: select planprefac0_.planSeq as planSeq ......
Hibernate: select planadl0_.planSeq as planSeq7_ ......
Hibernate: select planclaima0_.planSeq as planSeq7_ ......
Hibernate: select company0_.code as code0_ ......
Hibernate: select statecode0_.code as code0_ ......
Hibernate: select sexcode0_.code as code0_ ......
Hibernate: select planprefac0_.planSeq as planSeq7_ ......
Hibernate: select planprefac0_.planSeq as planSeq8_ ......

Hibernate: select planadl0_.planSeq as planSeq7_
Hibernate: select planclaima0_.planSeq as planSeq7_
Hibernate: select statecode0_.code as code0_
Hibernate: select planprefac0_.planSeq as planSeq7_
Hibernate: select planprefac0_.planSeq as planSeq8_
Hibernate: select planadl0_.planSeq as planSeq7_
Hibernate: select planclaima0_.planSeq as planSeq7_
Hibernate: select planprefac0_.planSeq as planSeq7_
Hibernate: select planprefac0_.planSeq as planSeq7_
Hibernate: select planadl0_.planSeq as planSeq7_
Hibernate: select planclaima0_.planSeq as planSeq7_
Hibernate: select planprefac0_.planSeq as planSeq7_
Hibernate: select planprefac0_.planSeq as planSeq8_
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have my pojo classes, hbm.xml files and my application runs fine
Might be but without them your whole situations is not likely to be solved by someone else, so please provide them!
 
bob du
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the pojo class is a typical class with setter/getter methods.

here is a snippet of one of the hbm.xml file in case this may help

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


<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.1

http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->

<class
name="hibernate.PlanPreface"
table="Plan_Preface"
>
<cache usage="read-write"/>

<id
name="planSeq"
type="java.lang.Long"
column="planSeq"
>
<generator class="native" />
</id>

<property
name="planCode"
type="java.lang.String"
column="planCode"
not-null="true"
length="20"
/>

<!-- Associations -->
<!-- bi-directional one-to-many association to PlanBenefit -->
<bag
name="planBenefits"
lazy="true"
inverse="true"
cascade="all"
>
<key>
<column name="planSeq" />
</key>
<one-to-many
class="hibernate.PlanBenefit"
/>
</bag>


<!-- bi-directional one-to-one association to PlanAdl -->
<one-to-one
name="planAdl"
class="hibernate.PlanAdl"
outer-join="auto"
cascade="delete"
/>

<many-to-one name="insproCompany" class="hibernate.Company" insert="false" update="false">
<column name="company" />
</many-to-one>

<many-to-one name="stateCode" class="hibernate.StateCode" insert="false" update="false">
<column name="state" />
</many-to-one>

<many-to-one name="sexCode" class="hibernate.SexCode" insert="false" update="false">
<column name="gender" />
</many-to-one>

<!-- bi-directional one-to-one association to PlanPrefaceCoverage -->
<one-to-one
name="coverage"
class="hibernate.PlanPrefaceCoverage"
cascade="all"
/>
<!-- bi-directional one-to-one association to PlanPrefaceMaximum -->
<one-to-one
name="maximum"
class="hibernate.PlanPrefaceMaximum"
cascade="all"
/>
</class>
</hibernate-mapping>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic