-->
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: Spring & Hibernate, Found bit, expected TINYINT(1) DEFAULT 0
PostPosted: Thu Jan 17, 2013 11:03 am 
Newbie

Joined: Wed Jan 16, 2013 11:30 am
Posts: 2
In database: there is a field whos type is TINYINT(1) and default value is 0. And in Model it is defined as TINYINT(1) DEFAULT 0. However it gives error such as below:

Error

[jar:file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/NetaCommerceFrameworkAdmin/WEB-INF/lib/NetaCommerceFramework-0.0.1-SNAPSHOT.jar!/com/netasoft/commerce/framework/lang/dao/LangDaoImpl.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type
[org.hibernate.SessionFactory]: :Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring/admin-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Wrong column type in kaft.nc_alert_log for column alerted. Found: bit, expected: TINYINT(1) DEFAULT 0; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring/admin-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Wrong column type in kaft.nc_alert_log for column alerted. Found: bit, expected: TINYINT(1) DEFAULT 0
Model definition

@Column(name="alerted", columnDefinition = "TINYINT(1) DEFAULT 0")
private int alerted;

public int getAlerted() {
return alerted;
}

public void setAlerted(int alerted) {
this.alerted = alerted;
}
Db.properties

hibernate.hbm2ddl.auto=validate
#hibernate.hbm2ddl.auto=create-drop
hibernate.hbm2ddl.import_files=/import_standard.sql
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.generate_statistics=false
hibernate.use_sql_comments=true
hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
hibernate.cache.use_query_cache=true
hibernate.cache.region.factory_class=net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory
hibernate.cache.use_second_level_cache=true
#-------------------------------------------------------------------------------
# MySQL Settings

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/xxx?autoReconnect=true
jdbc.username=xxx
jdbc.password=xxx

# Property that determines which Hibernate dialect / MySQL5Dialect || MySQLDialect
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
Dialect Versions:

2013-01-17 08:45:36,920 INFO [org.hibernate.cfg.SettingsFactory] - Database ->
name : MySQL
version : 5.0.96-community-nt
major : 5
minor : 0
2013-01-17 08:45:36,921 INFO [org.hibernate.cfg.SettingsFactory] - Driver ->
name : MySQL-AB JDBC Driver
version : mysql-connector-java-5.1.12 ( Revision: ${bzr.revision-id} )
major : 5
minor : 1
it is running on server and another computer, too. However in my computer and new computer which is installed just to try it gives same error. I am searching for days on google, couldnt figure out what caueses the issue. Tried boolean columnDefinition in model and change MySqlDialect definition however nothing change. Even error message is same.


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.