-->
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: "could not load an entity:" while getting a specif
PostPosted: Tue Oct 21, 2008 6:45 am 
Newbie

Joined: Mon Aug 18, 2008 8:40 am
Posts: 6
Hi,

I'm using hibernate with spring DAO support.I have this problem that doesn't occur on localhost.Mysql versions and configurations are different on localhost and the remote server(for example lower case table names was my first problem).But I couldn't figure this out.

As I've said it occurs only on the remote server and only on this table(Kitap_Istek).
Only happpens on
Code:
public Object find(Class clazz, Integer id) {
      Object ob = super.getHibernateTemplate().get(clazz, id);
      return ob;
   }

Doesn't happen on findAll or findByCriteria.
There is an another table that is almost the same as this table with little (one or two columns) changes,It runs perfectly.

I'm trying to solve this for about 2 days.I've look through every little detail on mapping files,configuration files(hibernate.cfg.xml,applicationContext.xml) and the tables but I couldn't find any problem.

It might be character encoding,however it would occur on the almost the same table if it was.I'm missing something.

Any ideas?

Thanks.


Hibernate version: 3.26

Full stack trace of any exception that occurs:

Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: could not load an entity: [model.Kitap_Istek#3]; nested exception is org.hibernate.exception.SQLGrammarException: could not load an entity: [model.Kitap_Istek#3]
Caused by: org.hibernate.exception.SQLGrammarException: could not load an entity: [model.Kitap_Istek#3]
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1326)
at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:116)
at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:101)
at org.hibernate.persister.entity.BasicEntityPersister.load(BasicEntityPersister.java:2461)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:350)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:331)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:113)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:151)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:79)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:617)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:610)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:470)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:464)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:458)
at dao.Kitap_IstekDAO.find(Kitap_IstekDAO.java:25)
at service.Kitap_IstekManagerImpl.find(Kitap_IstekManagerImpl.java:23)
at ui.Test.main(Test.java:16)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?ste0_.ID as ID7_, kitap_?ste0_.kitapId as kitapId8_7_, kitap_?ste0_.kisiId as k' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1885)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1239)
at org.hibernate.loader.Loader.doQuery(Loader.java:374)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1312)
... 17 more


Name and version of the database you are using: mysql
remote version : 5.0.45 (red-hat)
localhost version : 5.0.51b-community-nt-log (windows)

The generated SQL (show_sql=true): false


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.