-->
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.  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: What does "not for production use" mean?
PostPosted: Mon Nov 27, 2006 4:42 am 
Regular
Regular

Joined: Mon Jul 31, 2006 4:59 pm
Posts: 53
Hibernate version: 3.2

When i start my Application and have a look in the log-file, i see this Hibernate-Message:

Quote:
14513 [http-8080-Processor24] INFO org.hibernate.connection.DriverManagerConnectionProvider -Using Hibernate built-in connection pool (not for production use!)



And here my hibernate.cfg.xml

Code:
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>

    <!-- Don't forget to copy your JDBC driver to the lib/ directory! -->
    <!-- Settings for a local MySQL database. -->
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>

    <property name="connection.url">jdbc:mysql://localhost:3306/mysystem</property>
    <property name="connection.username">root</property>

    <property name="connection.password"></property>
   
    <!-- Use the Hibernate built-in pool for tests. -->
    <property name="connection.pool_size">3</property>

    <!-- Print SQL to stdout. -->
    <property name="show_sql">true</property>
   
   <!-- Mappings -->
    <mapping resource="MyVault.hbm.xml"/>
   
   
  </session-factory>
</hibernate-configuration>



Can someone please explain me what does this message mean?


Last edited by Hiperman on Tue Nov 28, 2006 4:29 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 6:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
eh...that you should not use the DriverManagerConnectionProvider for production. I thought that would be pretty obvious ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 6:13 am 
Regular
Regular

Joined: Mon Jul 31, 2006 4:59 pm
Posts: 53
Ok, and what should i do now? Can you help me please?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 6:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
before you go to production test and use a different connection provider; they are all documented in the docs.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 6:20 am 
Regular
Regular

Joined: Mon Jul 31, 2006 4:59 pm
Posts: 53
Can you recommend a connection provider?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 6:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
did you read the docs ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 6:49 am 
Regular
Regular

Joined: Mon Jul 31, 2006 4:59 pm
Posts: 53
Aehm - no *g*
Cant find the right link :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 2:37 pm 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
http://www.hibernate.org/hib_docs/v3/re ... ernatejdbc

Hibernate's own connection pooling algorithm is however quite rudimentary. It is intended to help you get started and is not intended for use in a production system or even for performance testing. You should use a third party pool for best performance and stability. Just replace the hibernate.connection.pool_size property with connection pool specific settings. This will turn off Hibernate's internal pool. For example, you might like to use C3P0.

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 4:28 am 
Regular
Regular

Joined: Mon Jul 31, 2006 4:59 pm
Posts: 53
Is this allright so?

Code:
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>

    <!-- Don't forget to copy your JDBC driver to the lib/ directory! -->
    <!-- Settings for a local MySQL database. -->
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>

    <property name="connection.url">jdbc:mysql://localhost:3306/mysystem</property>
    <property name="connection.username">root</property>

    <property name="connection.password"></property>
   
   
    <property name="c3p0.min_size">5</property>
      <property name="c3p0.max_size">20</property>

      <property name="c3p0.timeout">300</property>
      <property name="c3p0.max_statements">50</property>
      <property name="c3p0.idle_test_period">3000</property>

   
    <!-- Print SQL to stdout. -->
    <property name="show_sql">true</property>
   
   <!-- Mappings -->
    <mapping resource="MyVault.hbm.xml"/>
   
   
  </session-factory>
</hibernate-configuration>


When i start my application, i get this messages:

Quote:
5175 [http-8080-Processor23] INFO org.hibernate.cfg.Environment -Hibernate 3.2 cr2
5185 [http-8080-Processor23] INFO org.hibernate.cfg.Environment -hibernate.properties not found
5195 [http-8080-Processor23] INFO org.hibernate.cfg.Environment -Bytecode provider name : cglib
5255 [http-8080-Processor23] INFO org.hibernate.cfg.Environment -using JDK 1.4 java.sql.Timestamp handling
5555 [http-8080-Processor23] INFO org.hibernate.cfg.Configuration -configuring from resource: /hibernate.cfg.xml
5555 [http-8080-Processor23] INFO org.hibernate.cfg.Configuration -Configuration resource: /hibernate.cfg.xml
5836 [http-8080-Processor23] INFO org.hibernate.cfg.Configuration -Reading mappings from resource: MyVault.hbm.xml
6246 [http-8080-Processor23] INFO org.hibernate.cfg.HbmBinder -Mapping class: testsystem.MyVault -> MyVault
6306 [http-8080-Processor23] INFO org.hibernate.cfg.Configuration -Configured SessionFactory: null
6577 [http-8080-Processor23] INFO org.hibernate.connection.C3P0ConnectionProvider -C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/mysystem
6577 [http-8080-Processor23] INFO org.hibernate.connection.C3P0ConnectionProvider -Connection properties: {user=root, password=****}
6577 [http-8080-Processor23] INFO org.hibernate.connection.C3P0ConnectionProvider -autocommit mode: false
6847 [http-8080-Processor23] INFO com.mchange.v2.log.MLog -MLog clients using log4j logging.
6997 [http-8080-Processor23] INFO com.mchange.v2.c3p0.C3P0Registry -Initializing c3p0-0.9.0 [built 11-July-2005 00:43:29 -0400; debug? true; trace: 10]
7428 [http-8080-Processor23] INFO com.mchange.v2.c3p0.PoolBackedDataSource -Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@38fff7 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@cade31 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> cade31, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, maxIdleTime -> 1800, maxPoolSize -> 5, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1647278 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1647278, jdbcUrl -> jdbc:mysql://localhost:3306/mysystem, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ], factoryClassLocation -> null, identityToken -> 38fff7, numHelperThreads -> 3 ]
29018 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -RDBMS: MySQL, version: 5.0.27-community-nt
29018 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.13 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )
29148 [http-8080-Processor23] INFO org.hibernate.dialect.Dialect -Using dialect: org.hibernate.dialect.MySQLDialect
29218 [http-8080-Processor23] INFO org.hibernate.transaction.TransactionFactoryFactory -Using default transaction strategy (direct JDBC transactions)
29278 [http-8080-Processor23] INFO org.hibernate.transaction.TransactionManagerLookupFactory -No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
29278 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Automatic flush during beforeCompletion(): disabled
29278 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Automatic session close at end of transaction: disabled
29278 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -JDBC batch size: 15
29278 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -JDBC batch updates for versioned data: disabled
29288 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Scrollable result sets: enabled
29288 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -JDBC3 getGeneratedKeys(): enabled
29288 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Connection release mode: auto
29288 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Maximum outer join fetch depth: 2
29298 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Default batch fetch size: 1
29298 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Generate SQL with comments: disabled
29298 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Order SQL updates by primary key: disabled
29298 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
29308 [http-8080-Processor23] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory -Using ASTQueryTranslatorFactory
29308 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Query language substitutions: {}
29308 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Second-level cache: enabled
29308 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Query cache: disabled
29308 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Cache provider: org.hibernate.cache.EhCacheProvider
29379 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Optimize cache for minimal puts: disabled
29379 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Structured second-level cache entries: disabled
29419 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Echoing all SQL to stdout
29419 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Statistics: disabled
29419 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Deleted entity synthetic identifier rollback: disabled
29419 [http-8080-Processor23] INFO org.hibernate.cfg.SettingsFactory -Default entity-mode: pojo
29629 [http-8080-Processor23] INFO org.hibernate.impl.SessionFactoryImpl -building session factory
29669 [http-8080-Processor23] WARN net.sf.ehcache.config.ConfigurationFactory -No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/C:/Programme/Apache Software Foundation/Tomcat 5.0/work/Catalina/localhost/mysystem/loader/ehcache-failsafe.xml
30851 [http-8080-Processor23] INFO org.hibernate.impl.SessionFactoryObjectFactory -Not binding factory to JNDI, no JNDI name configured



Is everything ok? Or did i have to change some settings?

Thank you for helping! :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 5:57 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
I think your config is OK (no ERRORs).

Anyway I suggest to read some documentation about C3PO and connection pools in general, to be more comfortable with your development :)

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 6:10 am 
Regular
Regular

Joined: Mon Jul 31, 2006 4:59 pm
Posts: 53
This warning is making me confuse:

Quote:
29669 [http-8080-Processor23] WARN net.sf.ehcache.config.ConfigurationFactory -No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/C:/Programme/Apache Software Foundation/Tomcat 5.0/work/Catalina/localhost/mysystem/loader/ehcache-failsafe.xml


I have read something about this second-level cache. Did i have to use it ? How can i activate it ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 6:15 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
I suggest to not use it (2nd level cache) in the beginning:

<hibernate-configuration>
...
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
</hibernate-configuration>

Then, if you have performance issues, play with it and with the Query Cache:

http://www.hibernate.org/hib_docs/v3/re ... ance-cache

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 6:24 am 
Regular
Regular

Joined: Mon Jul 31, 2006 4:59 pm
Posts: 53
Ok thank you for the information. I have installed the ehcache like this:

ehcache.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
   <diskStore path="java.io.tmp"/>
   <defaultCache
     maxElementsInMemory="10"
     eternal="false"
     timeToIdleSeconds="120"
     timeToLiveSeconds="120"
     overflowToDisk="true"/>
   <cache name="com.mysystem.MyVault"
       maxElementsInMemory="20"
     eternal="false"
     timeToIdleSeconds="120"
     timeToLiveSeconds="180"
     overflowToDisk="true"/>
</ehcache>



MyVault.hbm.xml
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>

   <class name="com.mysystem.MyVault" >
       <cache usage="read-write"/>
   
      <id name="id" type="long">
         <generator class="native">
         </generator>
      </id>
      
      <property name="error" type="integer"/>
      <property name="timestamp" type="java.sql.Timestamp"/>
         
   </class>
</hibernate-mapping>



You say that a Second Level cache is only usefull if i have performance problems?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 6:32 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
Exactly. If you don't have them, don't bother with it.

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 7:12 am 
Regular
Regular

Joined: Mon Jul 31, 2006 4:59 pm
Posts: 53
Ok thank you. I have disabled caching.

I am now receiving this warning when i run my application:

Quote:
357722 [Thread-34] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner -com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@40d611 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!

357722 [Thread-34] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner -com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@40d611 -- APPARENT DEADLOCK!!! Complete Status: [num_managed_threads: 3, num_active: 3; activeTasks: com.mchange.v2.resourcepool.BasicResourcePool$5@14d659d (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1), com.mchange.v2.resourcepool.BasicResourcePool$5@4a3158 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0), com.mchange.v2.resourcepool.BasicResourcePool$5@ed8eb5 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2); pendingTasks: com.mchange.v2.resourcepool.BasicResourcePool$5@343bb6, com.mchange.v2.resourcepool.BasicResourcePool$5@13c3b45, com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@15738e0, com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@15726ec, com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@bc6007, com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@144752d]
timelistener


Any idea whats wrong? Something must be wrong with my C3P0 configuration :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 24 posts ]  Go to page 1, 2  Next

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.