-
Patch
-
Resolution: Obsolete
-
Major
-
JBossAS-5.0.0.CR1
-
None
findByPrimaryKey() in CMP for an entity bean will re-use the first property as query parameter of a composite primary key for all fields in the SQL query. Our code worked in JBoss 3.2.3 and got broken in 5.0.0CR1.
In ejb-jar.xml we have
- prim-key-class
- primkey-field
the prim-key-class exposes 3 properties (1 string, 2 integers). Through tracing and debugging we saw that the query gets constructed and parameter types are inferred correctly.
We compared QueryParameter.java from 3.2.3, 5.0.0 CR1 and v85552 (trunk as of today) and think that functionality got lost (please not the additional "else" for the "property != null" case. We therefore propose the following patch (which at least solved our problem):
— QueryParameter.java (Revision 85552)
+++ QueryParameter.java (Arbeitskopie)
@@ -320,10 +320,18 @@
}
arg = field.getPrimaryKeyValue(arg);
- // use mapper
- final JDBCType jdbcType = field.getJDBCType();
- arg = jdbcType.getColumnValue(0, arg);
- param = jdbcType.getParameterSetter()[0];
+ if(property != null)
+ { + arg = property.getColumnValue(arg); + param = property.getParameterSetter(); + }
+ else
+
}
else if(property != null)
{
(this was original created here: https://jira.jboss.org/jira/browse/ASPATCH-411)