[Persistence, JBoss/CMP, Hibernate, Database] - Hibernate Shards Newbie needs Help
by oni_FFM
hi,
i tried to use my project with Hibernate Shards but i cant.
At first i want to ask, if i can use Hibernate Shards with Oracle 10.g Database?
Second, i receive Exception
| 09:04:07 ERROR - org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(301) | Could not synchronize database state with session
| org.hibernate.exception.DataException: Could not execute JDBC batch update
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
|
| Caused by: java.sql.BatchUpdateException: ORA-01438: value larger than specified precision allowed for this column
|
| at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:629)
| at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9409)
|
|
i dont know why, i set my fields with value < 100. It is impossible that "value larger than specified precision allowed for this column"
Did someone use Hibernate Shards?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227969#4227969
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227969
14 years, 12 months
[Persistence, JBoss/CMP, Hibernate, Database] - Blob to String mapping
by test222222
Hello,
I'm using Hibernate as JPA provider and I'm trying to map clob field form database to String attribute in entity (JPA spec allows this).
Declaration in entity:
@Lob
| String name;
Declaration in database table:
name varchar(max),
But when I tried to read entity I got following exceptions (depending on jdbc driver I used):
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from varchar to BLOB is unsupported.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:170)
at com.microsoft.sqlserver.jdbc.DataTypes.throwConversionError(DataTypes.java:946)
at com.microsoft.sqlserver.jdbc.ServerDTVImpl.getValue(dtv.java:1952)
at com.microsoft.sqlserver.jdbc.DTV.getValue(dtv.java:175)
at com.microsoft.sqlserver.jdbc.Column.getValue(Column.java:113)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getValue(SQLServerResultSet.java:1982)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getValue(SQLServerResultSet.java:1967)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getBlob(SQLServerResultSet.java:2444)
at org.hibernate.type.BlobType.get(BlobType.java:80)
at org.hibernate.type.BlobType.nullSafeGet(BlobType.java:134)
at org.hibernate.loader.hql.QueryLoader.getResultColumnOrRow(QueryLoader.java:356)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:629)
at org.hibernate.loader.Loader.doQuery(Loader.java:724)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
or
org.hibernate.PropertyAccessException: could not set a field value by reflection setter of model.Entity.name
javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of model.Entity.name
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:76)
at TestTest.test3(TestTest.java:66)
Caused by: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of model.Entity.name
at org.hibernate.property.DirectPropertyAccessor$DirectSetter.set(DirectPropertyAccessor.java:114)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:360)
at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:221)
at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3594)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:152)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
at org.hibernate.loader.Loader.doQuery(Loader.java:752)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67)
Caused by: java.lang.IllegalArgumentException: Can not set int field model.Entity.name to org.hibernate.lob.SerializableBlob
at java.lang.reflect.Field.set(Field.java:657)
at org.hibernate.property.DirectPropertyAccessor$DirectSetter.set(DirectPropertyAccessor.java:102)
Which suggests that hibernate doesn't support this mapping. Is it true? Is there any clean solution to this problem or I have to use some kind of workaround?
My environment:
MS SQL Server 2005, Hibernate (3.3.1.GA), JDBC Driver: JTDS (1.2.2) or Microsoft SQL Driver (2.0).
Greetings
Slawek
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227963#4227963
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227963
14 years, 12 months