-->
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.  [ 4 posts ] 
Author Message
 Post subject: question about Hibernate initialization
PostPosted: Thu Mar 10, 2005 11:54 pm 
Newbie

Joined: Thu Mar 10, 2005 11:40 pm
Posts: 5
Location: ZhongShan,China
I am a new Hibernate User,when I use
Hibernate 3
JbuilderX
Sqlserver2000 Database

and It give me following infomation:

INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/myShield;charset=GBK

my hibernate.cfg.xml as following:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="connection.username">sa</property>
<property name="connection.password">123</property>
<property name="connection.url">jdbc:jtds:sqlserver://localhost:1433/myShield;charset=GBK</property>

<property name="connection.pool.size">30</property>
<property name="statement_cache.size">30</property>
<property name="jdbc.fetch_size">50</property>
<property name="jdbc.batch_size">30</property>
<property name="show_sql">false</property>

<mapping resource="myshield/logActionForm.hbm.xml"/>


</session-factory>
</hibernate-configuration>

-----
HibernateUtil.java

package myshield;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import java.io.File;

public class HibernateUtil {

private static SessionFactory sessionFactory=null;;

static {
try {
sessionFactory = new Configuration().configure().buildSessionFactory();
}
catch (HibernateException ex) {
throw new RuntimeException(
"Exception building SessionFactory: " + ex.getMessage(),
ex);
}
}

public static final ThreadLocal session = new ThreadLocal();

public static Session currentSession() throws HibernateException {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}

public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null)
s.close();
}
}

---

Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();

----

logActionForm.hbm.xml
... ...
It can't built a new SessionFactory,when I debug here:

sessionFactory = new Configuration().configure().buildSessionFactory();

It always give me as following:
------
11:16:23,687 INFO Environment:456 - Hibernate 3.0rc1

11:16:23,890 INFO Environment:469 - hibernate.properties not found

11:16:24,015 INFO Environment:502 - using CGLIB reflection optimizer

11:16:24,031 INFO Environment:532 - using JDK 1.4 java.sql.Timestamp handling

11:16:24,109 INFO Configuration:1228 - configuring from resource: /hibernate.cfg.xml

11:16:24,156 INFO Configuration:1199 - Configuration resource: /hibernate.cfg.xml

11:16:26,890 INFO Configuration:439 - Mapping resource: myshield/logActionForm.hbm.xml

11:16:54,531 INFO HbmBinder:256 - Mapping class: myshield.logActionForm -> basic_info

11:16:55,218 INFO Configuration:1340 - Configured SessionFactory: null

11:16:55,312 INFO Configuration:844 - processing extends queue

11:16:55,328 INFO Configuration:848 - processing collection mappings

11:16:55,421 INFO Configuration:857 - processing association property references

11:16:55,468 INFO Configuration:884 - processing foreign key constraints

11:16:58,218 INFO Dialect:89 - Using dialect: org.hibernate.dialect.SQLServerDialect

11:16:58,703 INFO SettingsFactory:90 - Default batch fetch size: 1

11:16:58,765 INFO SettingsFactory:94 - Generate SQL with comments: disabled

11:16:58,859 INFO SettingsFactory:98 - Order SQL updates by primary key: disabled

11:16:58,875 INFO SettingsFactory:273 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory

11:16:59,093 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory

11:16:59,171 INFO SettingsFactory:106 - Query language substitutions: {}

11:16:59,562 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)

11:16:59,625 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20

11:16:59,718 INFO DriverManagerConnectionProvider:45 - autocommit mode: false

11:16:59,890 INFO DriverManagerConnectionProvider:80 - using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://localhost:1433/myShield;charset=GBK

11:16:59,921 INFO DriverManagerConnectionProvider:86 - connection properties: {user=sa, password=****, pool.size=30}

11:17:03,453 INFO SettingsFactory:148 - JDBC batch size: 30

11:17:03,500 INFO SettingsFactory:151 - JDBC batch updates for versioned data: disabled

11:17:03,593 INFO SettingsFactory:156 - Scrollable result sets: enabled

11:17:03,625 INFO SettingsFactory:164 - JDBC3 getGeneratedKeys(): enabled

11:17:03,687 INFO SettingsFactory:168 - JDBC result set fetch size: 50

11:17:03,812 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)

11:17:03,984 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)

11:17:04,062 INFO SettingsFactory:176 - Automatic flush during beforeCompletion(): disabled

11:17:04,125 INFO SettingsFactory:179 - Automatic session close at end of transaction: disabled

11:17:04,156 INFO SettingsFactory:260 - Cache provider: org.hibernate.cache.EhCacheProvider

11:17:04,359 INFO SettingsFactory:187 - Second-level cache: enabled

11:17:04,406 INFO SettingsFactory:192 - Optimize cache for minimal puts: disabled

11:17:04,437 INFO SettingsFactory:199 - Structured second-level cache entries: enabled

11:17:04,484 INFO SettingsFactory:203 - Query cache: disabled

11:17:04,531 INFO SettingsFactory:214 - Statistics: disabled

11:17:04,578 INFO SettingsFactory:218 - Deleted entity synthetic identifier rollback: disabled

11:17:04,640 INFO SettingsFactory:232 - Default entity-mode: pojo

11:17:09,500 INFO SessionFactoryImpl:140 - building session factory

11:17:09,796 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/myshield/myshield/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml

11:17:14,109 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/myShield;charset=GBK


------
Is there anybody who know about this?why it give me so infomation like :cleaning up connection pool?please help me,Thanks!


Top
 Profile  
 
 Post subject: Nobody know why I can't build a new SessionFactory?
PostPosted: Fri Mar 11, 2005 2:47 am 
Newbie

Joined: Thu Mar 10, 2005 11:40 pm
Posts: 5
Location: ZhongShan,China
Nobody know why I can't build a new SessionFactory?
I can't believe?

Is there anybody can help me?
Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 11, 2005 8:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There is no error anywhere in the stuff you posted. Please start reading some basic tutorials to learn how hibernate works.

And yes, stop bumping your posts in the forum.


Top
 Profile  
 
 Post subject: TKS
PostPosted: Fri Mar 11, 2005 8:46 pm 
Newbie

Joined: Thu Mar 10, 2005 11:40 pm
Posts: 5
Location: ZhongShan,China
TKS,I had solved this problem,yes,like you said,there was no errors in my code and Config file,but I made a mistake in my Hbm.xml file,after I corrected it,and My hibernate program can work well,Thanks again.


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