-->
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: Slow initializing of object from ResultSet
PostPosted: Fri Jun 11, 2004 8:52 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:49 am
Posts: 21
Hi

I'm doing some speed-testing on Hibernate vs. my companys old databaseservice, and experiencing some slow behavior from Hibernate. When trying to load 256 objects from my database, Hibernate seems to take some time at initializing the object..

I'm using:
* Hibernate 2.1.3
* MSSQL Server (Remote location)
* JTDS v. 0.8

A small clip from my log4j output:

12:02:55,404 DEBUG Loader:404 - result row: 1086954809560
12:02:55,420 DEBUG Loader:535 - Initializing object from ResultSet: 1086954809560


(I've tried to turn off the logging but the time spent do not decrease..)

As you see Hibernate takes about 16 ms to intialize each object. Is this normal?

My Java code between open- and closeSession:

private List getObject(String hql) throws HibernateException
{
ArrayList temp = new ArrayList();
Session session ;
Transaction transaction = null;
try{
session = HibernateUtil.currentSession();
transaction = session.beginTransaction();
temp = (ArrayList) session.find(hql);
transaction.commit();
}catch(HibernateException e){
e.printStackTrace();
if(transaction!=null)
transaction.rollback();
}
return temp;
}


The method called:

public ObjectA[] getAllObjectA() throws HibernateException {
//------HQL------------
String hql = "from ObjectA order by sortIndex";
//------HQL------------
List temp = getObject(hql);
Kpi[] ret = new Kpi[temp.size()];
temp.toArray(ret);

return ret;
}


hibernate.properties:

#define query langugage constants/function names
hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'

##PLATFORM
#MySQL

## JNDI Datasource

#hibernate.connection.datasource jdbc/quickstart

## MS SQL Server

hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
hibernate.connection.username secret
hibernate.connection.password secret
hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
hibernate.connection.url jdbc:jtds:sqlserver://10.10.10.2:1433/test_hibernate
hibernate.jdbc.use_scrollable_resultset false

#Hibernate Connection Pool
#hibernate.connection.pool_size 5

hibernate.connection.provider_class net.sf.hibernate.connection.C3P0ConnectionProvider

###########################
### C3P0 Connection Pool###
###########################

hibernate.c3p0.max_size 4
hibernate.c3p0.min_size 2
hibernate.c3p0.timeout 5000
hibernate.c3p0.max_statements 100
hibernate.c3p0.idle_test_period 3000
hibernate.c3p0.acquire_increment 2
##hibernate.c3p0.validate false


##MISCELLANEOUS SETTINGS
#Show SQL
hibernate.show_sql false
#auto shema export
#hibernate.hbm2ddl.auto update

#set the the maximum JDBC 2 batch size (a nonzero value enables batching)
hibernate.jdbc.batch_size 0

#use streams when writing binary types to/from JDBC
hibernate.jdb.use_streams_for_binary true

#Set the maximum depth of the outer join fetch tree
hibernate.max_fetch_depth 1

#transaction factory
hibernate.transaction.factory_class net.sf.hibernate.transaction.JDBCTransactionFactory



The mapping file is straightforward except one one-to-many association wich is set to lazy. We're using assigned id-generator, but that should not cause speed problem?

To summarize - Hibernate takes to long initializing my objects.


[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 11, 2004 10:14 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:49 am
Posts: 21
My bad

I generated my id in the default constructor..

i know, i'm dumb ..


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.