-->
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.  [ 1 post ] 
Author Message
 Post subject: load entire DB tables
PostPosted: Tue Aug 19, 2008 10:16 am 
Newbie

Joined: Wed Aug 06, 2008 2:29 pm
Posts: 5
Hello,

My program loads all the DB objects on startup. The "root" object is UserInfo (see below mapping document). As you can see, it has four collections (and we are adding more). Currently, for each user, the DB needs to make at least one call per collection (4), and it is quite slow. As we are loading the entire DB anyway, it would make sense to load the tables in 'one shot' instead of loading each entity one at a time. How can we do this?


Hibernate version:
1.2.0.4000

Mapping documents:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
<class name="UserInfo.UserInfo,UserInfo" table="TUSER" lazy="false" mutable="true" batch-size="10">


<id name="Id" column="USER_ID" type="int">
<generator class="assigned"/>
</id>

<property name="Login" column="USER_CODE" type="System.String" unique="true">
</property>

<property name="UserType" column="USER_TYPE" not-null="true" type="UserInfo.UserProfileTypeType, UserInfo" />

<map name="InstrumentGroupRoles" table="TINSTGROUPUSR" sort="unsorted">
<key column="INSTGRPUSR_USER_ID"/>
<index-many-to-many column="INSTGRPUSR_INSTGRP_ID" class="UserInfo.InstrumentGroup,UserInfo"/>
<many-to-many column="INSTGRPUSR_ROLE_CODE" class="UserInfo.InstrumentGroupRole,UserInfo"/>
</map>

<!-- table="TMKTLOGIN"-->

<set name="MarketLogins">
<key column="MKTLOG_USER_ID"/>
<one-to-many class="UserInfo.MarketLogin,UserInfo" />
</set>

<set name="MarketRights">
<key column="UMKTRIGHT_USER_ID"/>
<one-to-many class="UserInfo.MarketRight,UserInfo" />
</set>

<set name="SystemRights">
<key column="USYSRIGHT_USER_ID"/>
<one-to-many class="UserInfo.SystemRight,UserInfo" />
</set>

</class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
ICriteria criteria = session.CreateCriteria(typeof(UserInfo));
IList<UserInfo> results = criteria.List<UserInfo>();

log.Info("Count: " + results.Count);
foreach (T result in results)
{
log.Info(result.ToString());
log.Info(Configuration.Parser.Serialize(result));
}

Name and version of the database you are using:
Oracle9i Enterprise Edition Release 9.2.0.5.0

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.