-->
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: Nothing happens after: processing foreign key constraints
PostPosted: Tue Oct 19, 2004 11:42 am 
Newbie

Joined: Mon Sep 13, 2004 4:00 pm
Posts: 15
Location: WI
I'm am trying to list all of the clients in our database. If I don't have the ClientGroup class mapping (along with the clientGroups set) in the mapping file it works fine. As soon as I add the ClientGroup class I get no output, and no debug messages.

The one thing that I find wierd is in the log file it says:

Code:
10:32:12,045  INFO Binder:1181 - Mapping collection: clientGroups -> DEXA020T


When clientGroups is the name of the collection.
Code:
<set name="clientGroups" inverse="true" cascade="all-delete-orphan" lazy="true">
    <key column="CLIENT_ID"/>
    <one-to-many class="ClientGroup"/>
</set>


Is that correct (I would think the class name ClientGroup would be mapped to the DEXA020T table, not the name of the collection in the parent class)? Why am I getting no output at all, and no messages in the log file? The application just terminates a few minutes after the last log message.

Hibernate version:
2.1

Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="ADMSTDDE">
    <!-- Please keep user defined mappings in this file only
     to avoid mixing user defined and system mappings. -->
    <!-- Mapping of User defined classes starts here -->
    <!-- CLIENT ************************************************************************** -->
    <class name="Client" table="DEXA010T">
        <id column="CLIENT_ID" name="id" type="string">
            <generator class="assigned"/>
        </id>
        <many-to-one name="wipStatus" column="wip_status_id"
           class="WipStatus" cascade="none"/>
        <property column="NAME" name="name" type="string"/>
        <property column="last_name" name="lastClientName" type="string"/>
        <property column="LAST_NAME_DT" name="nameUpdateDate" type="date"/>
        <property column="EFF_DT" name="effectiveDate" type="date"/>
        <many-to-one cascade="none"
            class="AgreementStatus"
            column="status_agr_id" name="agreementStatus"/>
        <property column="status_agr_dt" name="statusDate" type="date"/>
        <many-to-one cascade="none"
            class="AgreementStatus"
            column="last_status_agr_id" name="lastStatus"/>
        <property column="last_status_agr_dt" name="lastStatusDate" type="date"/>
        <many-to-one cascade="none"
            class="TerminationReason"
            column="tmn_reason_id" name="terminationReason"/>
        <property column="AUTO_FLAG" name="restrictAuto" type="boolean"/>
        <property column="HOME_FLAG" name="restrictHome" type="boolean"/>
        <property column="LIFE_FLAG" name="restrictLife" type="boolean"/>
        <property column="nb_pot_ants" name="potentialNumberOfAccounts" type="integer"/>
        <property column="last_pot_ants"
            name="lastPotentialNumberOfAccounts" type="integer"/>
        <property column="last_pot_ants_dt"
            name="potentialNumberOfAccountsUpdateDate" type="date"/>
        <many-to-one cascade="all"
            class="Contact"
            column="SALES_CNT_ID" name="salesRep"/>
        <property column="SALES_OFF_NB" name="salesOfficeNumber" type="string"/>
        <property column="STAT_CODE" name="statCode" type="string"/>
        <property column="DIRECT_BILL_FLAG" name="allowsDirectBilling" type="boolean"/>
        <property column="EFT_BILL_FLAG" name="allowsEft" type="boolean"/>
        <property column="PAYROLL_BILL_FLAG"
            name="allowsPayrollDeduction" type="boolean"/>
        <property column="DISCOUNT_EFF_DT" name="discountEffectiveDate" type="date"/>
        <many-to-one cascade="none"
            class="ClientType"
            column="TYPE_ID" name="type"/>
        <property column="LAST_MODIFIED_USER" name="lastUserToUpdate" type="string"/>
        <set name="clientGroups" inverse="true" cascade="all-delete-orphan" lazy="true">
          <key column="CLIENT_ID"/>
          <one-to-many class="ClientGroup"/>
        </set>
        <property column="LAST_MODIFIED_DTM" name="lastModifiedDate" type="date"/>
        <property column="DELETE_FLAG" name="deleted" type="boolean"/>
    </class>
       
    <class name="CodeValuePair" table="DEXA150T">
       <id column="CODE_ID" name="id" type="integer">
            <generator class="assigned"/>
        </id>
        <discriminator column="CODE_TYPE_NM" type="string"/>
          <property column="CODE" name="code" type="string"/>
          <property column="VALUE" name="value" type="string"/>
          <property column="DISPLAY_ORDER" name="sortOrder" type="integer"/>
       <!-- WIP STATUS ****************************************************************** -->
       <subclass name="WipStatus" discriminator-value="wip"/>
       <!-- AGREEMENT STATUS ***************************************************************** -->
       <subclass name="AgreementStatus" discriminator-value="status_agr"/>
       <!-- Termination Reason ******************************************************************* -->
       <subclass name="TerminationReason" discriminator-value="tmn_reason"/>
       <!-- CLIENT TYPE **************************************************************************** -->
       <subclass name="ClientType" discriminator-value="client_type"/>
    </class>   
   
    <!-- CONTACT *************************************************************************** -->
    <class name="Contact" table="DEXA160T">
        <id column="CONTACT_ID" name="id" type="integer">
            <generator class="sequence"/>
        </id>
        <property column="NAME" name="name" type="string"/>
        <property column="PHONE" name="phoneNumber" type="string"/>
        <property column="EXTENSION" name="phoneNumberExt" type="string"/>
        <property column="FAX" name="faxNumber" type="string"/>
        <property column="EMAIL" name="emailAddress" type="string"/>
    </class>
    <!-- CLIENT GROUP ************************************************************************ -->
    <class name="ClientGroup" table="DEXA020T">
        <id column="CLIENT_GROUP_ID" name="id" type="integer">
            <generator class="sequence"/>
        </id>
        <many-to-one name="client" class="Client"
            column="CLIENT_ID" not-null="true"/>
        <property column="NAME" name="name" type="string"/>
    </class>
    <!-- Mapping of User defined classes ends here -->       
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
[code]
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();

List result = session.find("from ClientGroup");

for (int i = 0; i<result.size(); i++) {
Client theClient = (Client) result.get(i);
System.out.println("Client id: " + theClient.getId() + " Name: " + theClient.getName());
}
System.out.println("\n" + result.size() + " Client.");

tx.commit();
sessionFactory.close();
[code]
Full stack trace of any exception that occurs:
...
Name and version of the database you are using:
DB2
The generated SQL (show_sql=true):
None generated.
Debug level Hibernate log excerpt:
[code]
Initializing Hibernate
10:32:10,413 INFO Environment:469 - Hibernate 2.1.6
10:32:10,423 INFO Environment:503 - loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true}
10:32:10,423 INFO Environment:529 - using CGLIB reflection optimizer
10:32:10,423 INFO Environment:540 - JVM does not support Statement.getGeneratedKeys()
10:32:10,433 INFO Environment:551 - JVM does not support LinkedHasMap, LinkedHashSet - ordered maps and sets disabled
10:32:10,433 INFO Environment:554 - using workaround for JVM bug in java.sql.Timestamp
10:32:10,443 INFO Configuration:895 - configuring from resource: /hibernate.cfg.xml
10:32:10,443 INFO Configuration:867 - Configuration resource: /hibernate.cfg.xml
10:32:11,004 INFO Configuration:331 - Mapping resource: HibernateConn/partial.hbm.xml
10:32:11,855 INFO Binder:229 - Mapping class: Client -> DEXA010T
10:32:11,985 INFO Binder:229 - Mapping class: CodeValuePair -> DEXA150T
10:32:12,025 INFO Binder:169 - Mapping subclass: WipStatus -> DEXA150T
10:32:12,025 INFO Binder:169 - Mapping subclass: AgreementStatus -> DEXA150T
10:32:12,025 INFO Binder:169 - Mapping subclass: TerminationReason -> DEXA150T
10:32:12,025 INFO Binder:169 - Mapping subclass: ClientType -> DEXA150T
10:32:12,025 INFO Binder:229 - Mapping class: Contact -> DEXA160T
10:32:12,025 INFO Binder:229 - Mapping class: ClientGroup -> DEXA020T
10:32:12,045 INFO Configuration:1053 - Configured SessionFactory: null
10:32:12,045 INFO Configuration:627 - processing one-to-many association mappings
10:32:12,045 INFO Binder:1181 - Mapping collection: clientGroups -> DEXA020T
10:32:12,055 INFO Configuration:636 - processing one-to-one association property references
10:32:12,075 INFO Configuration:661 - processing foreign key constraints
10:32:12,105 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.DB2Dialect
10:32:12,105 INFO SettingsFactory:63 - Use outer join fetching: true
10:32:12,105 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
10:32:12,115 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 20
10:32:12,226 INFO DriverManagerConnectionProvider:77 - using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:DB2T
10:32:12,226 INFO DriverManagerConnectionProvider:78 - connection properties: {user=VKDB2T2, password=cvet6xsr}
10:32:12,236 INFO TransactionFactoryFactory:31 - Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
10:32:12,236 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
10:32:12,887 INFO SettingsFactory:103 - Use scrollable result sets: true
10:32:12,887 INFO SettingsFactory:106 - Use JDBC3 getGeneratedKeys(): false
10:32:12,887 INFO SettingsFactory:109 - Optimize cache for minimal puts: false
10:32:12,887 INFO SettingsFactory:115 - echoing all SQL to stdout
10:32:12,887 INFO SettingsFactory:118 - Query language substitutions: {}
10:32:12,887 INFO SettingsFactory:129 - cache provider: net.sf.hibernate.cache.HashtableCacheProvider
10:32:12,897 INFO Configuration:1116 - instantiating and configuring caches
10:32:13,027 INFO SessionFactoryImpl:118 - building session factory
10:32:13,557 INFO ReflectHelper:186 - reflection optimizer disabled for: Client, BulkBeanException: null (property setName)
10:32:13,738 INFO ReflectHelper:186 - reflection optimizer disabled for: ClientGroup, BulkBeanException: null (property setName)
10:32:13,788 WARN XMLDatabinder:261 - no XSLT implementation found - databinding disabled
10:32:13,798 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
10:32:13,798 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.DB2Dialect
10:32:13,808 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
10:32:13,808 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 20
10:32:13,808 INFO DriverManagerConnectionProvider:77 - using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:DB2T
10:32:13,808 INFO DriverManagerConnectionProvider:78 - connection properties: {user=VKDB2T2, password=cvet6xsr}
10:32:13,808 INFO SchemaUpdate:102 - Running hbm2ddl schema update
10:32:13,808 INFO SchemaUpdate:110 - fetching database metadata
10:32:14,509 INFO SchemaUpdate:124 - updating schema
10:32:14,509 INFO Configuration:627 - processing one-to-many association mappings
10:32:14,519 INFO Configuration:636 - processing one-to-one association property references
10:32:14,519 INFO Configuration:661 - processing foreign key constraints
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 11:55 am 
Newbie

Joined: Mon Sep 13, 2004 4:00 pm
Posts: 15
Location: WI
Sorry for the messed up code tags.....I don't see an edit button?

Also, I have a typo in the code that in the above post (I was changing it around testing things). This line:
Code:
List result = session.find("from ClientGroup");


Should really be:
Code:
List result = session.find("from Client");


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 2:27 pm 
Newbie

Joined: Mon Sep 13, 2004 4:00 pm
Posts: 15
Location: WI
I have simplified my mapping file down to a bare minimum. If the mapping file is this it prints out my Clients w/o a problem:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="ADMSTDDE">
    <class name="Client" table="DEXA010T">
        <id column="CLIENT_ID" name="id" type="string">
            <generator class="assigned"/>
        </id>
        <property column="NAME" name="name" type="string"/>
    </class>
</hibernate-mapping>


However if I add just the class and id elements for the ClientGroup class it will exit w/o printing any messages:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="ADMSTDDE">
    <class name="Client" table="DEXA010T">
        <id column="CLIENT_ID" name="id" type="string">
            <generator class="assigned"/>
        </id>
        <property column="NAME" name="name" type="string"/>
    </class>
    <class name="ClientGroup" table="DEXA020T">
        <id column="CLIENT_GROUP_ID" name="id" type="integer">
            <generator class="sequence"/>
        </id>
    </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.