-->
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.  [ 3 posts ] 
Author Message
 Post subject: Elements in Collection Null
PostPosted: Mon Feb 13, 2006 9:41 am 
Newbie

Joined: Mon Feb 13, 2006 8:10 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

Mapping documents: 3.0

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

Spring Hibernate template support

Full stack trace of any exception that occurs:
No exception - Collection contains null value

Name and version of the database you are using:

Oracle 9i

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Constraint on table:

ALTER TABLE CHECK ADD (
CONSTRAINT CHK_CHECK_CAT_DEP_REG_FL CHECK (("CATEGORY" = 'F' AND "CODE" IS NOT NULL AND "FLIGHT" IS NOT NULL) OR
("CATEGORY" = 'D' AND "AIRPORT" IS NOT NULL ) OR
("CATEGORY" = 'R' AND "REGION" IS NOT NULL ) ));


CREATE TABLE CHECK
(
CODE VARCHAR2(5 BYTE) NOT NULL,
CATEGORY VARCHAR2(1 BYTE) NOT NULL,
REGION VARCHAR2(3 BYTE),
CARRIER VARCHAR2(3 BYTE),
FLIGHT VARCHAR2(5 BYTE),
AIRPORT VARCHAR2(5 BYTE),
MAXTIME NUMBER NOT NULL,
MINTIME NUMBER NOT NULL,
)



the contraints above and table design does not force certain fields to be filled in.

So in DB there can be some fields as null.

When getting the object, some elements in the collection are NULL


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 8:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Not showing enough information -such as the mapping- for someone to help you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 1:07 am 
Newbie

Joined: Mon Feb 13, 2006 8:10 am
Posts: 2
david wrote:
Not showing enough information -such as the mapping- for someone to help you.


Code:
<?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>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
    <class name="com.domain.mapping.Check" table="CHECK">
        <composite-id name="id" class="com.domain.mapping.CheckId">
            <key-property name="code" type="string">
                <column name="CODE" length="5" />
            </key-property>
            <key-property name="category" type="string">
                <column name="CATEGORY" length="1" />
            </key-property>
            <key-property name="region" type="string">
                <column name="REGION" length="3" />
            </key-property>
            <key-property name="carrier" type="string">
                <column name="CARRIER" length="3" />
            </key-property>
            <key-property name="flightnumber" type="string">
                <column name="FLIGHTNUMBER" length="5" />
            </key-property>
            <key-property name="destination" type="string">
                <column name="DESTINATION" length="5" />
            </key-property>
            <key-property name="maxtime" type="big_decimal">
                <column name="MAXTIME" precision="22" scale="0" />
            </key-property>
            <key-property name="mintime" type="big_decimal">
                <column name="MINTIME" precision="22" scale="0" />
            </key-property>
            <key-property name="updTmstmp" type="string">
                <column name="UPD_TMSTMP" length="15" />
            </key-property>
            <key-property name="host" type="string">
                <column name="HOST" length="3" />
            </key-property>
        </composite-id>
        <many-to-one name="Region" class="com.domain.mapping.Region" update="false" insert="false" fetch="select">
            <column name="REGIONCODE" length="3" />
            <column name="HOST" length="3" not-null="true" />
        </many-to-one>
        <many-to-one name="Host" class="com.domain.mapping.Host" update="false" insert="false" fetch="select">
            <column name="HOST" length="3" not-null="true" />
        </many-to-one>
        <many-to-one name="Airport" class="com.domain.mapping.Airport" update="false" insert="false" fetch="select">
            <column name="AIRPORTCODE" length="5" not-null="true" />
            <column name="HOST" length="3" not-null="true" />
        </many-to-one>
    </class>
</hibernate-mapping>


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