[nbusers] Re: Using Hibernate in a Java Swing Application - NetBeans IDE Tutorial

  • From: "bolsover" < >
  • To:
  • Subject: [nbusers] Re: Using Hibernate in a Java Swing Application - NetBeans IDE Tutorial
  • Date: Wed, 30 May 2012 10:25:36 -0400

Don't worry about log4j - I just downloaded the project - looks like it's all 
setup to use commons logging...

This is what I get when I run the app..



Code:
May 30, 2012 2:53:41 PM org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.1.GA
May 30, 2012 2:53:41 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
May 30, 2012 2:53:41 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
May 30, 2012 2:53:41 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
May 30, 2012 2:53:41 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
May 30, 2012 2:53:41 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
May 30, 2012 2:53:41 PM org.hibernate.cfg.Configuration 
getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
May 30, 2012 2:53:41 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : sakila/entity/Actor.hbm.xml
May 30, 2012 2:53:41 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
May 30, 2012 2:53:41 PM org.hibernate.cfg.HbmBinder 
bindRootPersistentClassCommonValues
INFO: Mapping class: sakila.entity.Actor -> actor
May 30, 2012 2:53:41 PM org.hibernate.cfg.AnnotationConfiguration 
secondPassCompile
INFO: Hibernate Validator not found: ignoring
May 30, 2012 2:53:41 PM 
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
May 30, 2012 2:53:41 PM 
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
May 30, 2012 2:53:41 PM 
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
May 30, 2012 2:53:41 PM 
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: 
jdbc:mysql://localhost:3306/sakila
May 30, 2012 2:53:41 PM 
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****}
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 5.5.23
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.13 
( Revision: ${bzr.revision-id} )
May 30, 2012 2:53:41 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
May 30, 2012 2:53:41 PM org.hibernate.transaction.TransactionFactoryFactory 
buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
May 30, 2012 2:53:41 PM 
org.hibernate.transaction.TransactionManagerLookupFactory 
getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of 
read-write or transactional second-level cache is not recommended)
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory 
createQueryTranslatorFactory
INFO: Query translator: 
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
May 30, 2012 2:53:41 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
May 30, 2012 2:53:41 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
May 30, 2012 2:53:41 PM org.hibernate.impl.SessionFactoryObjectFactory 
addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Hibernate: select actor0_.actor_id as actor1_0_, actor0_.first_name as 
first2_0_, actor0_.last_name as last3_0_, actor0_.last_update as last4_0_ 
from sakila.actor actor0_ where (actor0_.first_name like 'PEN%' )




-- so the prebuilt solution seems to work just fine...

also, if I right click the hibernate.cfg.xml and select Run HQL Query and 
enter "from Actor a where a.firstName like 'PE%'", I get the expected result. 
- does this work for you?


I had to do two things to get the app working after downloading:
1 fix a missing reference - I needed to include the Mysql driver 
2 add <property name="hibernate.connection.password">Secret</property> to the 
hibernate.cfg.xml - because my database is configured to require password.


I did manage to reproduce the error you see - 

I typed 'from actor' in the HQL query window

I should have typed 'from Actor'... HQL IS case sensitive.






[nbusers] Re: Using Hibernate in a Java Swing Application - NetBeans IDE Tutorial

bolsover 05/30/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close