-->
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: Hibernate Long problem with Adabas D
PostPosted: Wed Jul 05, 2006 4:12 pm 
Newbie

Joined: Wed Jul 05, 2006 3:46 pm
Posts: 1
Location: Argentina
Hi all this is my first post.

I was testing hibernate for a lot of time but I have a serious problem still.

If I have a number with length of 11 in the database (Fixed(11)) in some field when Hibernate try to load that entity it throws and Invalid Numeric Parameter Exception.

The Driver of the database is ok, the access vía JDBC is ok but it SEEMS (I'm not suree 100%) that the comunication between hibernate and jdbc isn't working very well with Long Types in this database.

more info:
RDBMS: ADABAS D, version: 13.01.08.04
(64 Bits, SO: Sun Solaris Sparc)
JDBC driver: JDBC for ADABAS D, version: 11.2.1.1
Hibernate 3.1
JDK 1.4.2


Some Stack Trace:


2006-07-05 17:01:01,357 ERROR [org.hibernate.util.JDBCExceptionReporter] - <INVALID NUMERIC PARAMETER>
2006-07-05 17:01:01,357 INFO [org.hibernate.event.def.DefaultLoadEventListener] - <Error performing load command>
org.hibernate.exception.GenericJDBCException: could not load an entity: [some.package.Person#80000110322]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.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:167)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:79)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:651)

.
.
.
.
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: INVALID NUMERIC PARAMETER
at de.sag.jdbc.adabasd.server.AServer.throwSQLException(AServer.java:874)
at de.sag.jdbc.adabasd.server.AServer.sendExecuteRequest(AServer.java:627)
at de.sag.jdbc.adabasd.APreparedStatement.sendExecuteRequest(APreparedStatement.java:354)
at de.sag.jdbc.adabasd.APreparedStatement.executeQuery(APreparedStatement.java:162)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1239)


Some piece of the mapping file:


<class name="some.package.Person" table="PERSON">


<id name="nuPerson" column="NU_PERSON">
<generator class="assigned"/>
</id>

<property name="nuDoc" column="NU_DOC" />
<property name="dtNacimiento" column="DT_NACIMIENTO" />
.
.
.
</class>


The Person bean:

package some.package;


import java.io.Serializable;
import java.sql.Timestamp;

public class Person implements Serializable {

private Long nuPerson;

public Long getNuPerson() {
return nuPerson;
}

public void setNuPerson(Long nuPerson) {
this.nuPerson = nuPerson;
}
.
.
.
}


Solutions that I had test (that now I remember:) ):

1. Try with double:
The double number went in cientific notation so I can't find the objects I need.

2. Extending SAPDBDialect with the addings in the constructor:

public AdabasDDialect() {
super();
registerColumnType(Types.BIGINT, "fixed(18,0)");
registerColumnType(Types.INTEGER, "fixed(9,0)");
//registerColumnType(Types.DOUBLE, "fixed($p,$s)");
registerColumnType(Types.NUMERIC, "fixed($p,$s)");
registerColumnType(Types.DOUBLE, "fixed(22,$s)");
}

'cause AdabasD has a limit in the fixed types of 18.

3. Implementing UserCustomTypes:
Converting between types.


If you can help I will say thanks a lot!! :)
'cause is an error that I can't understand what it is.

Regards! and Thanks in advance.

_________________
Matutek


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.