You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by PICARD Jérôme <jp...@aston.fr> on 2003/03/03 16:42:14 UTC
OJB and HSQLDB
Hello,
I have a problem with HSQLDB, I use OJB 0.9.8.
When I store an object with a primary key, I obtain this exception.
Have you an idea ?
<class-descriptor
class="test.banque.domaine.compte.OperationCredit"
table="OPERATION"
>
<field-descriptor id="1"
name="id"
column="OPE_ID"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
/>
<field-descriptor id="2"
name="compteId"
column="ACC_ID"
jdbc-type="INTEGER"
/>
<field-descriptor id="3"
name="libelle"
column="OPE_LABEL"
jdbc-type="VARCHAR"
/>
<field-descriptor id="4"
name="montant"
column="OPE_AMOUNT"
jdbc-type="DOUBLE"
/>
<field-descriptor id="5"
name="date"
column="OPE_DATE"
jdbc-type="DATE"
conversion="aston.solution.ojb.converters.DateToDateSQL"
/>
</class-descriptor>
Exception :
DBMS:Hsqldb
DRIVER: org.hsqldb.jdbcDriver
PROTOCOL: jdbc
SUBPROTOCOL: hsqldb
DBALIAS: hsql://localhost:9001
USERNAME: sa
PASSWORD:
EAGER RELEASE: false
at
org.apache.ojb.broker.util.sequence.SequenceGenerator.getNextSequence(Sequen
ceGenerator.java:92)
at
org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl.getUniqueId(Sequ
enceManagerHiLoImpl.java:65)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getUniqueId(Persistence
BrokerImpl.java:2272)
at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getUniqueId(Deleg
atingPersistenceBroker.java:248)
at
org.apache.ojb.broker.metadata.ClassDescriptor.getAutoIncrementValue(ClassDe
scriptor.java:1082)
at
org.apache.ojb.broker.metadata.ClassDescriptor.getKeyValuesForObject(ClassDe
scriptor.java:931)
at
org.apache.ojb.broker.metadata.ClassDescriptor.getKeyValues(ClassDescriptor.
java:908)
at
org.apache.ojb.broker.metadata.ClassDescriptor.getKeyValues(ClassDescriptor.
java:883)
at org.apache.ojb.broker.Identity.<init>(Identity.java:191)
... 21 more
Caused by: org.apache.ojb.broker.PersistenceBrokerException: Could not
borrow connection from pool -
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
JdbcConnectionDescriptor
DBMS:Hsqldb
DRIVER: org.hsqldb.jdbcDriver
PROTOCOL: jdbc
SUBPROTOCOL: hsqldb
DBALIAS: hsql://localhost:9001
USERNAME: sa
PASSWORD:
EAGER RELEASE: false
at
org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(St
atementsForClassImpl.java:245)
at
org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt(Sta
tementsForClassImpl.java:188)
at
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Stat
ementManager.java:632)
at
org.apache.ojb.broker.accesslayer.JdbcAccess.executeQuery(JdbcAccess.java:24
0)
at
org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:249)
at
org.apache.ojb.broker.singlevm.RsIteratorFactoryImpl.createRsIterator(RsIter
atorFactoryImpl.java:95)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getRsIteratorFromQuery(
PersistenceBrokerImpl.java:2505)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getRsIteratorFromQueryE
xtentAware(PersistenceBrokerImpl.java:1719)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getIteratorFromQuery(Pe
rsistenceBrokerImpl.java:1599)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1250)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1405)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1431)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1418)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByQuery(Persis
tenceBrokerImpl.java:1818)
at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getObjectByQuery(
DelegatingPersistenceBroker.java:275)
at
org.apache.ojb.broker.util.sequence.SequenceGenerator.getNextSequence(Sequen
ceGenerator.java:57)
... 29 more
Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could not
borrow connection from pool -
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
JdbcConnectionDescriptor
DBMS:Hsqldb
DRIVER: org.hsqldb.jdbcDriver
PROTOCOL: jdbc
SUBPROTOCOL: hsqldb
DBALIAS: hsql://localhost:9001
USERNAME: sa
PASSWORD:
EAGER RELEASE: false
at
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnectionF
romPool(ConnectionFactoryPooledImpl.java:69)
at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnec
tion(ConnectionFactoryAbstractImpl.java:89)
at
org.apache.ojb.broker.accesslayer.ConnectionManager.getConnection(Connection
Manager.java:122)
at
org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareStatement(St
atementsForClassImpl.java:240)
... 44 more
Caused by: java.util.NoSuchElementException
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPoo
l.java:720)
at
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnectionF
romPool(ConnectionFactoryPooledImpl.java:65)
... 47 more
Re: automatically mapping inherited fields
Posted by Joerg Lensing <in...@softcon-lensing.de>.
hi thomas,
this was exactly my question.
joerg
Thomas Mahler schrieb:
> Hi Joerg,
>
> I'm not quite sure if I got your question.
> Are you asking if the field-descriptors for "name" and "number" must
> be present in the class-descriptors for the concrete classes, or if it
> is possible to just define them once in the base-classes descriptor?
>
> The answer to this question is: No,they have to be defined in each
> concrete classes class-descriptor!
>
> Thomas
>
> Joerg Lensing wrote:
>
>> hi,
>> is it possible to map "base"-fields from a base-class?
>>
>> Base-class: BaseX.class
>> fields: name, number
>>
>> (concrete) inherited classes: -->ExtendedBaseX_A
>> -->ExtendedBaseX_B
>> .....|_________->ExtendedBaseX_B_xyz
>>
>> all Classes need the same fields "name" and "number". They allways
>> use the same
>> tablefieldnames (same and separate tables). Is there a way to map
>> these two fields
>> automatically to the tables?
>>
>> joerg
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
Re: automatically mapping inherited fields
Posted by Thomas Mahler <th...@web.de>.
Hi Joerg,
I'm not quite sure if I got your question.
Are you asking if the field-descriptors for "name" and "number" must be
present in the class-descriptors for the concrete classes, or if it is
possible to just define them once in the base-classes descriptor?
The answer to this question is: No,they have to be defined in each
concrete classes class-descriptor!
Thomas
Joerg Lensing wrote:
> hi,
> is it possible to map "base"-fields from a base-class?
>
> Base-class: BaseX.class
> fields: name, number
>
> (concrete) inherited classes:
> -->ExtendedBaseX_A
> -->ExtendedBaseX_B
> .....|_________->ExtendedBaseX_B_xyz
>
> all Classes need the same fields "name" and "number". They allways use
> the same
> tablefieldnames (same and separate tables). Is there a way to map these
> two fields
> automatically to the tables?
>
> joerg
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
automatically mapping inherited fields
Posted by Joerg Lensing <in...@softcon-lensing.de>.
hi,
is it possible to map "base"-fields from a base-class?
Base-class: BaseX.class
fields: name, number
(concrete) inherited classes:
-->ExtendedBaseX_A
-->ExtendedBaseX_B
.....|_________->ExtendedBaseX_B_xyz
all Classes need the same fields "name" and "number". They allways use
the same
tablefieldnames (same and separate tables). Is there a way to map these
two fields
automatically to the tables?
joerg