db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Ahlers <m...@hippo.nl>
Subject Problem with SequenceManagerNativeImpl and MySql
Date Fri, 09 Apr 2004 10:56:49 GMT
Hi,

I am using rc6 and MySQL (4.0.18-nt) database. All I want is to have the 
primary key after a store (for new object), the database uses 
auto-increment, and I am experimenting with several SequenceManagers.

The SequenceManagerInMemoryImpl works, however not suitable for multiple 
instances will work on the database. The documentation says I should use 
a special Manager because of MySQL and therefore I am using 
SequenceManagerNativeImpl. This works partially, as in, it generates 
negative primary keys (and not unique), but when I am setting 
access="readonly" in my reposity for field-descriptor I receive the 
following error:

[org.apache.ojb.broker.core.PersistenceBrokerImpl] ERROR: SQLException 
during SequenceManager.afterStore (for a nl.hippo.nvpt.Articles): Syntax 
error or access
violation,  message from server: "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 'CALL IDENTITY()' at line 1"
Syntax error or access violation,  message from server: "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 'CALL IDENTITY()' 
at line 1" java.sql.SQLException: Syntax error or access violation,  
message from server: "
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 'CALL 
IDENTITY()' at line 1"
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1876)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1098)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1192)
        at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1153)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2048)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2005)
        at com.mysql.jdbc.Statement.executeQuery(Statement.java:1156)
        at 
org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl.getLastInsert(SequenceManagerNativeImpl.java:263)
        at 
org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl.afterStore(SequenceManagerNativeImpl.java:155)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBrokerImpl.java:1465)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java:1378)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java:730)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersistenceBroker.java:165)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersistenceBroker.java:165)

Current setup:
--- start snippet ---
<sequence-manager 
className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl">
            <attribute attribute-name="grabSize" attribute-value="10"/>
</sequence-manager>

<class-descriptor class="nl.hippo.nvpt.Articles" table="ARTICLES">
        <field-descriptor name="id" primarykey="true" 
autoincrement="true" access="readonly" nullable="false" 
default-fetch="true" column="ID" jdbc-type="INTEGER"/>
        ....
--- end snippet ---

What am I missing here? Or are there other solutions?

Thanks in advance,
Mike Ahlers

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message