Hi there,
I just switched my datasource from Hypersonic to MySQL.
JBoss Version 3.2.5
MySQL Version 4.0.18
Connector/J Version 3.0.14
The szenario is like this - I have a contract which consists of components that in
turn have fields ordered by a sequence holding a value. The aggregation table stores
all this information including references to the contract and the component table. As
per Spec I initialize the CMP fields in the ejbCreate-method and set the CMR-relations
in the ejbPostCreate-method.
The Statement that JBoss tries to execute is:
DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.ComponentFieldValue]
| Executing SQL: INSERT INTO COMPONENTFIELDVALUE (CONTRACT, COMPONENT, FIELDNAME,
SEQUENCE, VALUE, component, contract)
| VALUES (?, ?, ?, ?, ?, ?, ?)
Everything was running fine with Hypersonic, but now I get the following error message:
ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.ComponentFieldValue]
| Could not create entity
| java.sql.SQLException: General error, message from server: "Column 'CONTRACT'
specified twice" at
| com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1977)
| at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1163)
| at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1272)
| at com.mysql.jdbc.Connection.execSQL(Connection.java:2236)
| at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1741)
| at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1588)
| at
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:335).......
// ==============================================================
| // Create Method
| // ==============================================================
|
| /**
| * @return
| * @throws CreateException
| *
| * @ejb.create-method
| */
| public ComponentFieldValuePK ejbCreateFieldValue(Integer contract, Integer
component,
| String fieldname, String value, ContractLocal conl , ComponentLocal coml)
| throws CreateException, FinderException{
| setContract(contract);
| setComponent(component);
| setFieldname(fieldname);
| setSequence(new Integer(0));
| setValue(value);
| return null;
| }
|
| public void ejbPostCreateFieldValue(Integer contract, Integer component,
| String fieldname, String value, ContractLocal conl, ComponentLocal coml){
| setContractCMR(conl);
| setComponentCMR(coml);
| }
|
|
| // ==============================================================
| // Container Managed Relations
| // ==============================================================
|
| /**
| * @return
| *
| * @ejb.interface-method
| * @ejb.relation name = "ContractAndCFValueRelation"
| * role-name = "CFValueHasContract"
| * target-role-name = "ContractHasCFValues"
| * target-ejb = "Contract"
| * cascade-delete = "yes"
| *
| * @jboss.relation fk-column = "contract"
| * related-pk-field = "id"
| * fk-constraint = "true"
| */
| public abstract ContractLocal getContractCMR();
| public abstract void setContractCMR(ContractLocal con);
|
|
| /**
| * @return
| *
| * @ejb.interface-method
| * @ejb.relation name = "ComponentAndCFValueRelation"
| * role-name = "CFValueHasComponent"
| * target-role-name = "ComponentHasCFValue"
| * target-ejb = "Component"
| * cascade-delete = "yes"
| *
| * @jboss.relation fk-column = "component"
| * related-pk-field = "id"
| * fk-constraint = "true"
| */
| public abstract ComponentLocal getComponentCMR();
| public abstract void setComponentCMR(ComponentLocal col);
I found a posting on the net that has the same problem, but I couldn't find a solution
yet.
http://www.mail-archive.com/[EMAIL PROTECTED]/msg00317.html
Has anybody solved this problem yet ?? Is this a JBoss issue or a MySQL issue ??
thanks
matt
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3843916#3843916
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3843916
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user