-->
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: Able to save, 100% cpu when trying to access object property
PostPosted: Mon Sep 20, 2004 11:32 am 
Beginner
Beginner

Joined: Wed May 12, 2004 2:52 pm
Posts: 36
Hibernate version: hibernate-2.1.4

Mapping documents:
Code:
<?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>

    <class
        name="employeeclub.domain.Activity"
        table="activity"
    >

        <id
            name="id"
            type="long"
            column="id"
        >
            <generator class="net.sf.hibernate.id.TableHiLoGenerator">
                <param name="table">activity_seq</param>
                <param name="column">next_hi</param>
                <param name="max_lo">1</param>
            </generator>
        </id>

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


        <!-- associations -->
        <!-- bi-directional one-to-one association to ActivityTicket -->
        <one-to-one
            name="activityTicket"
            class="employeeclub.domain.ActivityTicket"
            property-ref="activity"
            cascade="all"
            outer-join="false"
        />
        <!-- bi-directional many-to-one association to Category -->
        <many-to-one
            name="category"
            class="employeeclub.domain.Category"
            not-null="true"
        >
            <column name="category_id" />
        </many-to-one>
    </class>
</hibernate-mapping>
<?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>
    <subclass name="employeeclub.domain.ActivityTicket" extends="employeeclub.domain.Ticket" discriminator-value="ACTIVITY_TICKET">
        <!-- bi-directional many-to-one association to Activity -->
        <many-to-one
            name="activity"
            class="employeeclub.domain.Activity"
            column="detail_id"
            cascade="all"
            unique="true"
            outer-join="false"
        />
    </subclass>
</hibernate-mapping>
<?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>

    <subclass name="employeeclub.domain.Ticket" extends="employeeclub.domain.Item"/>
   
</hibernate-mapping>
<?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>

    <class
        name="employeeclub.domain.Item"
        table="item"
        polymorphism="implicit"
        discriminator-value="not null"
    >
        <id
            name="id"
            type="long"
            column="id"
        >
            <generator class="net.sf.hibernate.id.TableHiLoGenerator">
                <param name="table">item_seq</param>
                <param name="column">next_hi</param>
                <param name="max_lo">1</param>
            </generator>
        </id>
        <discriminator
            column="type_id"
            type="java.lang.String"
        />
        <property
            name="name"
            type="java.lang.String"
            column="name"
            not-null="true"
            length="255"
        />
        <property
            name="listPrice"
            type="employeeclub.dao.hibernate.type.MoneyType"
            column="list_price"
            not-null="true"
            length="19"
        />
        <property
            name="unitCost"
            type="employeeclub.dao.hibernate.type.MoneyType"
            column="unit_cost"
            not-null="true"
            length="19"
        />
        <property
            name="description"
            type="java.lang.String"
            column="description"
            not-null="true"
            length="255"
        />

        <property
            name="quantity"
            type="int"
            column="quantity"
            not-null="true"
            length="4"
        />

    </class>
</hibernate-mapping>
<?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>

    <class
        name="employeeclub.domain.Category"
        table="category"
    >

        <id
            name="id"
            type="long"
            column="id"
        >
            <generator class="net.sf.hibernate.id.TableHiLoGenerator">
                <param name="table">category_seq</param>
                <param name="column">next_hi</param>
                <param name="max_lo">1</param>
            </generator>
        </id>

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

    </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close(): Using spring

Full stack trace of any exception that occurs: No exceptions

Name and version of the database you are using: MsSql 2000

The generated SQL (show_sql=true):
Code:
Hibernate: select activity0_.id as id, activity0_.name as name, activity0_.description as descript3_, activity0_.category_id as category4_ from activity activity0_
Activity - setting activityTicket
Activity - setting activityTicket
Hibernate: select activityti0_.id as id0_, activityti0_.detail_id as detail_id0_, activityti0_.name as name0_, activityti0_.list_price as list_price0_, activityti0_.unit_cost as unit_cost0_, activityti0_.description as descript6_0_, activityti0_.quantity as quantity0_ from item activityti0_ where activityti0_.detail_id=?
ActivityTicket - setting activity
Hibernate: select category0_.id as id0_, category0_.name as name0_ from category category0_ where category0_.id=?
Activity - setting activityTicket
Activity - setting category
Hibernate: select activityti0_.id as id0_, activityti0_.detail_id as detail_id0_, activityti0_.name as name0_, activityti0_.list_price as list_price0_, activityti0_.unit_cost as unit_cost0_, activityti0_.description as descript6_0_, activityti0_.quantity as quantity0_ from item activityti0_ where activityti0_.detail_id=?


Debug level Hibernate log excerpt:







All, I am able to save these objects successfully. I am even able to retieve a collection of "Activity" objects with out a problem. The problem occurs when I Iterate through the collection of objects. As soon as I try to access a property, my cpu shoots up to 100% and the process seems to hang. Any idea whats going on?

Regards,

Joshua[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 2:17 am 
Regular
Regular

Joined: Thu Aug 05, 2004 2:27 am
Posts: 54
Location: South Africa
Put a breakpoint in the loop, and see where it's going.,
I didn't read the mapping, but it's entirely possible that you're going round in circles, one break point and a few steps to find it.


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.