Bugs item #517018, was opened at 2002-02-13 16:26
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=517018&group_id=22866
Category: JBossCMP
Group: v3.0 Rabbit Hole
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Thomas Hamann (thomash76)
Assigned to: Dain Sundstrom (dsundstrom)
Summary: forced cmp-field init during create
Initial Comment:
windows 2000; jdk1.3.1_01; JBoss 3.0.0DR1(2-13-2002; GMT 10:00);
Hi,
i tried to create instance of an entity bean, but all i got was exceptions until i
initialized all cmp
fields during the ejbCreate() method of that bean. such a bug is not really severe
because an
initialization should always be possible (at least with default values) but according
to the ejb
specification the application provider does not have to initialize the cmp-fields. i
checked whether
the problem is in the database or in Jboss... the db allows creation of rows such as
(xyz, null, null)
- Jboss not! when encountering a null valued cmp-field the process of sql query
composition stops
and the creation of the bean instance is unsuccessful - see log output. (this was the
actual
problem of bug #516404 "invalid type mapping")
2002-02-13 15:51:57,243 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.jatek/GlossaryEntry] Create:
pk=Reference [uid: 2176]
2002-02-13 15:51:57,258 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.jatek/GlossaryEntry] Executing
SQL:
SELECT COUNT(*) FROM GLOSSARYENTRY WHERE uid_column=?
2002-02-13 15:51:57,258 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.jatek/GlossaryEntry.uid]
Set
parameter: index=1, jdbcType=BIGINT, value=2176
2002-02-13 15:51:57,258 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.jatek/GlossaryEntry] Executing
SQL:
INSERT INTO GLOSSARYENTRY (uid_column, allowedUsers_column, allowedGroups_column,
deniedUsers_column, deniedGroups_column, par_column, pos_column, ver_column,
scr_column,
typLearnTime_column, matData_column) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2002-02-13 15:51:57,258 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.jatek/GlossaryEntry.uid]
Set
parameter: index=1, jdbcType=BIGINT, value=2176
2002-02-13 15:51:57,258 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.jatek/GlossaryEntry.allowedUsers]
Set
parameter: index=2, jdbcType=JAVA_OBJECT, value=NULL
2002-02-13 15:51:57,493 ERROR
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.jatek/GlossaryEntry] Could not
create
entity
javax.ejb.EJBException: Internal error setting parameters for field allowedUsers
Embedded
Exception
Ung�ltiger Spaltentyp
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.setArgumentParameters(JDBCAbs
tractCMPFieldBridge.java:238)
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.setInstanceParameters(JDBCAbst
ractCMPFieldBridge.java:211)
at ...
seems like there's a problem in org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil at line 144
btw.: my "old" version of JBoss 3.0.0DR1 managed to create the tables itself by using
the specified
type mapping - the new one (from this morning) doesn't - any clue?
Thanks for the support yesterday!
Thomas
----------------------------------------------------------------------
>Comment By: Thomas Hamann (thomash76)
Date: 2002-03-04 09:43
Message:
Logged In: YES
user_id=445709
I tested "implicit" type mapping ... JBoss still uses the wrong type mapping or it
does not evaluate the
<type-mapping> element in jbosscmp-jdbc.xml:
here's a part of my jbosscmp-jdbc.xml:
<jbosscmp-jdbc>
<defaults>
<datasource>java:/examplesDS</datasource>
<type-mapping>mySQL</type-mapping>
<create-table>true</create-table>
<remove-table>false</remove-table>
...
</defaults>
<enterprise-beans>
<entity>
<ejb-name>jatek/Chapter</ejb-name>
<table-name>CHAPTER</table-name>
<cmp-field>
<field-name>uid</field-name>
<column-name>uid_column</column-name>
</cmp-field>
<cmp-field>
<field-name>allowedUsers</field-name>
<column-name>allowedUsers_column</column-name>
</cmp-field>
...
when JBoss tries to create the db tables during deployment the following exception is
thrown:
2002-03-04 09:29:46,853 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.jatek/Chapter]
Executing SQL: CREATE TABLE CHAPTER (uid_column BIGINT NOT NULL, allowedUsers_column
OBJECT,
allowedGroups_column OBJECT, deniedUsers_column OBJECT, deniedGroups_column OBJECT,
par_column
BIGINT NOT NULL, pos_column INTEGER NOT NULL, ver_column VARCHAR(256), scr_column
INTEGER NOT
NULL, typLearnTime_column BIGINT NOT NULL, CONSTRAINT pk_CHAPTER PRIMARY KEY
(uid_column))
2002-03-04 09:29:46,868 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.jatek/Chapter] Could
not create table CHAPTER
2002-03-04 09:29:46,884 ERROR [org.jboss.ejb.EntityContainer] Exception in service
lifecyle operation:
start
org.jboss.deployment.DeploymentException: Error while creating table; - nested
throwable is:
java.sql.SQLException: Syntax error or access violation: You have an error in your SQL
syntax near
'OBJECT, allowedGroups_column OBJECT, deniedUsers_column OBJECT, deniedGroups_col' at
line 1
java.sql.SQLException: Syntax error or access violation: You have an error in your SQL
syntax near
'OBJECT, allowedGroups_column OBJECT, deniedUsers_column OBJECT, deniedGroups_col' at
line 1
at org.gjt.mm.mysql.MysqlIO.sendCommand(Unknown Source)
at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(Unknown Source)
at org.gjt.mm.mysql.MysqlIO.sqlQuery(Unknown Source)
at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)
at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)
at org.gjt.mm.mysql.Statement.executeUpdate(Unknown Source)
at org.gjt.mm.mysql.jdbc2.Statement.executeUpdate(Unknown Source)
at
org.jboss.resource.adapter.jdbc.local.StatementInPool.executeUpdate(StatementInPool.java:736)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:158)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:80)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:325)
at
org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:175)
at org.jboss.ejb.EntityContainer.start(EntityContainer.java:367)
at org.jboss.ejb.Container.invoke(Container.java:787)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:994)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:779)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:343)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:78)
at $Proxy3.start(Unknown Source)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:332)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:779)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:343)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:78)
at $Proxy3.start(Unknown Source)
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:415)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:468)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:345)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:325)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:78)
at $Proxy2.deploy(Unknown Source)
at
org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:295)
at
org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:466)
at
org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:356)
at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanne
r.java:190)
at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.
java:179)
org.jboss.deployment.DeploymentException: Error while creating table; - nested
throwable is:
java.sql.SQLException: Syntax error or access violation: You have an error in your SQL
syntax near
'OBJECT, allowedGroups_column OBJECT, deniedUsers_column OBJECT, deniedGroups_col' at
line 1
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:173)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:80)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:325)
at
org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:175)
at org.jboss.ejb.EntityContainer.start(EntityContainer.java:367)
at org.jboss.ejb.Container.invoke(Container.java:787)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:994)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:779)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:343)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:78)
at $Proxy3.start(Unknown Source)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:332)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:779)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:343)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:78)
at $Proxy3.start(Unknown Source)
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:415)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:468)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:345)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:325)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:78)
at $Proxy2.deploy(Unknown Source)
at
org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:295)
at
org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:466)
at
org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:356)
at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanne
r.java:190)
at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.
java:179)
look at the specified sql statement - an appropriate mysql statement would specify
"BLOB" instead of
"OBJECT" for cmp fields like allowedUsers (which contains a serialized Java object).
to me it seems as if
JBoss ignores the <type-mapping> element and uses the default "Hypersonic SQL" (which
is the only db with
a <sql-type> of "OBJECT") - or am i mistaken?
----------------------------------------------------------------------
Comment By: Thomas Hamann (thomash76)
Date: 2002-03-04 08:54
Message:
Logged In: YES
user_id=445709
This error occured with an Oracle 8.1.7 and i used type-mapping "Oracle8" from
standardjbosscmp-jdbc.xml.
Since i had some problems with the type mapping (Jboss did not use "Oracle8" but the
default "Hypersonic")
i decided to use explicit type mapping - added jdbc-type and sql-type for each
cmp-field in
jbosscmp-jdbc.xml. I did not test whether this bug (see #521558) is resolved in the
current CVS version.
Due to de-/serialization problems with Oracle BLOBs i switched to mySQL.
As soon as i can spare some time i'll run a test with "implicit" type mapping for
mySQL and without initialized
cmp fields and let you know!
----------------------------------------------------------------------
Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-03-03 21:59
Message:
Logged In: YES
user_id=251431
What database and type-mapping are you using?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=517018&group_id=22866
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development