|
Hi,
I have the following entity beans which have a 1-1
relationship:
person(id(integer), name(varchar))
job(id(integer), name(varchar))
This is part of my ejb-jar.xml:
<enterprise-beans>
<entity> <description></description> <cmp-version>2.0</cmp-version> <ejb-name>Person</ejb-name> <home>PersonHome</home> <remote>Person</remote> <ejb-class>PersonBean</ejb-class> <prim-key-class>java.lang.Integer</prim-key-class> <reentrant>False</reentrant> <persistence-type>Container</persistence-type> <cmp-field><field-name>id</field-name></cmp-field> <cmp-field><field-name>name</field-name></cmp-field> <cmp-field><field-name>jobid</field-name></cmp-field>
<primkey-field>id</primkey-field> </entity> </enterprise-beans> <enterprise-beans>
<entity> < description></description> <cmp-version>2.0</cmp-version> <ejb-name>Job</ejb-name> <home>JobHome</home> <remote>Job</remote> <ejb-class>JobBean</ejb-class> <prim-key-class>java.lang.Integer</prim-key-class> <reentrant>False</reentrant> <persistence-type>Container</persistence-type> <cmp-field><field-name>id</field-name></cmp-field> <cmp-field><field-name>name</field-name></cmp-field> <primkey-field>id</primkey-field> </entity> </enterprise-beans> And this is the relationship between them:
<relationships>
<ejb-relation> <ejb-relation-name>Person-Job</ejb-relation-name> <ejb-relationship-role> <ejb-relationship-role-name></ejb-relationship-role-name> <multiplicity>one</multiplicity> <role-source> <ejb-name>Person</ejb-name> <remote-ejb-name>Person</remote-ejb-name> <dependent-name>Person</dependent-name> </role-source> <cmr-field> <cmr-field-name>jobid</cmr-field-name> <cmr-field-type>Job</cmr-field-type> </cmr-field> </ejb-relationship-role> <ejb-relationship-role> <ejb-relationship-role-name></ejb-relationship-role-name> <multiplicity>one</multiplicity> <role-source> <ejb-name>Job</ejb-name> <remote-ejb-name>Job</remote-ejb-name> <dependent-name>Job</dependent-name> </role-source> </ejb-relationship-role> </ejb-relation> </relationships> Everything seems to
work fine, I mean, the entities get deployed etc...
The tables that Orion create are ok:
Person(name(varchar(50)), jobid(integer), id (integer primary key not
null))
Job(name(varchar(50)), id(integer primary key not null))
But when I try to create a new Person I get the following error:
[ODBC SQL SERVER DRIVER]
Optional feature not implemented
I've made a trace to the ODBC driver and I've found out that Orion tries to
fill the "jobid" field with
a SQLBIG_INT type instead of a integer type. This is what I get in the log
file:
Preparing (SQLPrepare), hStmt=151987528, szSqlStr=insert into Person
(name, jobid, id) VALUES (?, ?, ?)
Number of parameter markers (SQLNumParams), hStmt=151987528 Number of parameter markers (SQLNumParams),
hStmt=151987528
value=3 --- This is the name field--
Registering Statement sun.jdbc.odbc.JdbcOdbcPreparedStatement@486be5
Binding IN NULL parameter (SQLBindParameter), hStmt=151987528, ipar=1,
SQLtype=12
*PreparedStatement.setNull (1,12)
---This is the jobid field ---
Binding IN NULL parameter (SQLBindParameter), hStmt=151987528, ipar=2,
SQLtype=-5
*PreparedStatement.setNull (2,-5) ---The type -5 is the SQLBIG_INT type. I think it must be 4 which is the
integer type----
Binding IN NULL parameter (SQLBindParameter), hStmt=151987528, ipar=11, SQLtype=-5 RETCODE = -1 ERROR - Generating SQLException... SQLException: SQLState(S1C00) vendor code(0) java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterNull(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setNull(Unknown Source) at com.evermind.sql.ao.setNull(JAX) at com.evermind.sql.ao.setNull(JAX) at PersonHome_EntityHomeWrapper13.create(PersonHome_EntityHomeWrapper13.java:402) at Nuevo.doGet(NewPerson.java:328) at javax.servlet.http.HttpServlet.service(HttpServlet.java:190) at javax.servlet.http.HttpServlet.service(HttpServlet.java:302) at javax.servlet.http.HttpServlet.service(HttpServlet.java:329) at com.evermind.server.http.d3.sw(JAX) at com.evermind.server.http.d3.su(JAX) at com.evermind.server.http.ef.s1(JAX) at com.evermind.server.http.ef.do(JAX) at com.evermind.util.f.run(JAX) In the squema for the sql-server I have the
following mapping:
<type-mapping
type="java.lang.Integer" name="int" />
but anyway it still replace the Integer by
SQLBIG_INT
Does anybody know what I'm doing
wrong?
Thanks in advance.
|
- Re: EJB 2.0 again, again, please. fresnaULL
- Re: EJB 2.0 again, again, please. Johan Fredriksson
- Re: EJB 2.0 again, again, please. theis . meggerle
