-->
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: couple of questions
PostPosted: Fri Jul 16, 2010 9:24 pm 
Newbie

Joined: Fri Jul 16, 2010 9:10 pm
Posts: 1
Hi folks

I'm experimenting with Hibernate and MySQL on Fedora Core. I'm running a very simple example and having some problems.

hibernate.properties
    hibernate.dialect=org.hibernate.dialect.MySQLDialect
    hibernate.connection.driver_class=com.mysql.jdbc.Driver
    hibernate.connection.url=jdbc:mysql://127.0.0.1:3306/test
    hibernate.connection.username=markj
    hibernate.connection.password=**********

MyUsers.hbm.xml
    <hibernate-mapping>
    <class name="com.talim.demo.MyUsers" table="testInfoSchema">
    <id name="character_set_name" column="character_set_name" type="string">
    <generator class="assigned"/>
    </id>
    <property name="default_collate_name" type="string"/>
    <property name="description" type="string"/>
    </class>
    </hibernate-mapping>

my table
    mysql> desc testInfoSchema;
    +----------------------+-------------+------+-----+---------+-------+
    | Field | Type | Null | Key | Default | Extra |
    +----------------------+-------------+------+-----+---------+-------+
    | CHARACTER_SET_NAME | varchar(32) | NO | PRI | | |
    | DEFAULT_COLLATE_NAME | varchar(32) | NO | | | |
    | DESCRIPTION | varchar(60) | NO | | | |
    +----------------------+-------------+------+-----+---------+-------+
    3 rows in set (0.00 sec)

my output:
    run:
    [java] 25 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.5.3-Final
    [java] 30 [main] INFO org.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.connection.password=****, hibernate.connection.url=jdbc:mysql://127.0.0.1:3306/test, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.username=markj, hibernate.connection.driver_class=com.mysql.jdbc.Driver}
    [java] 33 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
    [java] 52 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
    [java] 314 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource: com/talim/demo/MyUsers.hbm.xml
    [java] 315 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource: com/talim/demo/MyUsers.hbm.xml
    [java] 580 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.talim.demo.MyUsers -> testInfoSchema
    [java] 786 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
    [java] 786 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
    [java] 786 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
    [java] 803 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://127.0.0.1:3306/test
    [java] 803 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=markj, password=****}
    [java] 1373 [main] WARN org.hibernate.cfg.SettingsFactory - Could not obtain connection to query metadata
    [java] java.sql.SQLException: Unexpected exception encountered during query.
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
    [java] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2608)
    [java] at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1856)
    [java] at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3457)
    [java] at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2328)
    [java] at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122)
    [java] at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774)
    [java] at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:371)
    [java] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289)
    [java] at java.sql.DriverManager.getConnection(libgcj.so.8rh)
    [java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
    [java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:114)
    [java] at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163)
    [java] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2159)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1383)
    [java] at com.talim.demo.MyUsersTest.main(MyUsersTest.java:24)
    [java] Caused by: java.io.CharConversionException
    [java] at gnu.gcj.convert.Input_iconv.read(libgcj.so.8rh)
    [java] at java.lang.String.init(libgcj.so.8rh)
    [java] at java.lang.String.<init>(libgcj.so.8rh)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.<init>(SingleByteCharsetConverter.java:155)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.initCharset(SingleByteCharsetConverter.java:110)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.getInstance(SingleByteCharsetConverter.java:88)
    [java] at com.mysql.jdbc.ConnectionImpl.getCharsetConverter(ConnectionImpl.java:2785)
    [java] at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:682)
    [java] at com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:666)
    [java] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2061)
    [java] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562)
    [java] ...14 more

    [java] 1477 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect
    [java] 1484 [main] INFO org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling contextual LOB creation as connection was null
    [java] 1486 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
    [java] 1490 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    [java] 1491 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
    [java] 1491 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
    [java] 1493 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: disabled
    [java] 1494 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
    [java] 1494 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
    [java] 1495 [main] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
    [java] 1495 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
    [java] 1495 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
    [java] 1495 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
    [java] 1495 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
    [java] 1495 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    [java] 1500 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
    [java] 1501 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
    [java] 1501 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
    [java] 1501 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
    [java] 1501 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
    [java] 1501 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
    [java] 1501 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
    [java] 1501 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
    [java] 1509 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
    [java] 1509 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
    [java] 1509 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
    [java] 1510 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
    [java] 1511 [main] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
    [java] 1680 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
    [java] 2105 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
    [java] 2331 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: S1000
    [java] 2331 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Unexpected exception encountered during query.
    [java] 2332 [main] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
    [java] org.hibernate.exception.GenericJDBCException: Cannot open connection
    [java] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
    [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
    [java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
    [java] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:116)
    [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
    [java] at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
    [java] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2395)
    [java] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2858)
    [java] at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
    [java] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
    [java] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
    [java] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:179)
    [java] at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
    [java] at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
    [java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
    [java] at com.talim.demo.MyUsersTest.main(MyUsersTest.java:54)
    [java] Caused by: java.sql.SQLException: Unexpected exception encountered during query.
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
    [java] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2608)
    [java] at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1856)
    [java] at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3457)
    [java] at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2328)
    [java] at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122)
    [java] at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774)
    [java] at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:371)
    [java] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289)
    [java] at java.sql.DriverManager.getConnection(libgcj.so.8rh)
    [java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
    [java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    [java] ...14 more
    [java] Caused by: java.io.CharConversionException
    [java] at gnu.gcj.convert.Input_iconv.read(libgcj.so.8rh)
    [java] at java.lang.String.init(libgcj.so.8rh)
    [java] at java.lang.String.<init>(libgcj.so.8rh)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.<init>(SingleByteCharsetConverter.java:155)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.initCharset(SingleByteCharsetConverter.java:110)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.getInstance(SingleByteCharsetConverter.java:88)
    [java] at com.mysql.jdbc.ConnectionImpl.getCharsetConverter(ConnectionImpl.java:2785)
    [java] at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:682)
    [java] at com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:666)
    [java] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2061)
    [java] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562)
    [java] ...24 more
    [java] Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
    [java] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
    [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
    [java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
    [java] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:116)
    [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
    [java] at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
    [java] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2395)
    [java] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2858)
    [java] at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
    [java] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
    [java] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
    [java] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:179)
    [java] at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
    [java] at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
    [java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
    [java] at com.talim.demo.MyUsersTest.main(MyUsersTest.java:54)
    [java] Caused by: java.sql.SQLException: Unexpected exception encountered during query.
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
    [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
    [java] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2608)
    [java] at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1856)
    [java] at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3457)
    [java] at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2328)
    [java] at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122)
    [java] at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774)
    [java] at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:371)
    [java] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289)
    [java] at java.sql.DriverManager.getConnection(libgcj.so.8rh)
    [java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
    [java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    [java] ...14 more
    [java] Caused by: java.io.CharConversionException
    [java] at gnu.gcj.convert.Input_iconv.read(libgcj.so.8rh)
    [java] at java.lang.String.init(libgcj.so.8rh)
    [java] at java.lang.String.<init>(libgcj.so.8rh)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.<init>(SingleByteCharsetConverter.java:155)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.initCharset(SingleByteCharsetConverter.java:110)
    [java] at com.mysql.jdbc.SingleByteCharsetConverter.getInstance(SingleByteCharsetConverter.java:88)
    [java] at com.mysql.jdbc.ConnectionImpl.getCharsetConverter(ConnectionImpl.java:2785)
    [java] at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:682)
    [java] at com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:666)
    [java] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2061)
    [java] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562)
    [java] ...24 more

    [java] Java Result: 1

The 2nd error occurs when I execute session.save(Object) on the Object that I'm trying to insert into the table. I'm a bit confused as to why. Is there any way to get any additional information to display (or is the cut off "...24 more" and ant thing?)

The 1st error occurs when I just connect and exit, so I don't think its a problem. I'm just curious what it means.

Any help would be greatly appreciated.

Mark


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.