You should rename your field to something else other than group. It would be the easier solution.
Thanks,
Chris
On Monday, January 6, 2003, at 02:40 AM, [EMAIL PROTECTED] wrote:
I'm encounter problem with unable to insert data to database with this
error message.
17:15:42,373 ERROR [Test1EJB] Could not create entity
java.sql.SQLException: Syntax error or access violation: You have an error
in your SQL syntax near 'group) VALUES ('1041848142313', 'PROD',
'2003-01-06 17:15:42', 5, 'G')' at line 1
My process is having JSP to input data and call the session bean to insert
data to the entity bean.
I'm using JBoss 3.0.4, MySQL database
#
# Table structure for table 'test1'
#
CREATE TABLE `test1` (
`EVENT_NUM` varchar(13) binary NOT NULL default '',
`PRODUCT` varchar(10) default NULL,
`EVENT_DATE` datetime default NULL,
`PARTICLE_COUNT` int(5) default NULL,
`GROUP` varchar(5) default NULL,
PRIMARY KEY (`EVENT_NUM`)
) TYPE=MyISAM;
#
# ejb-jar.xml
#
<entity>
<description>Test1 Entity Bean</description>
<ejb-name>Test1EJB</ejb-name>
<local-home>lpc.Test1Home</local-home>
<local>lpc.Test1</local>
<ejb-class>lpc.Test1Bean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Test1</abstract-schema-name>
<cmp-field>
<field-name>eventNum</field-name>
</cmp-field>
<cmp-field>
<field-name>product</field-name>
</cmp-field>
<cmp-field>
<field-name>eventDate</field-name>
</cmp-field>
<cmp-field>
<field-name>particle</field-name>
</cmp-field>
<cmp-field>
<field-name>group</field-name>
</cmp-field>
<primkey-field>eventNum</primkey-field>
</entity>
#
# sessen bean
#
public void insertTest1(String evCnt, String evGrp) {
String timeMilli = String.valueOf(System.currentTimeMillis());
Test1Home t1Home;
Test1 t1Rec;
java.sql.Date sqlDate = new java.sql.Date(System.currentTimeMillis());
try {
// Lookup Test1Home
InitialContext ic = new InitialContext();
t1Home = (Test1Home)ic.lookup("Test1Home");
t1Rec =
t1Home.create(timeMilli,"PROD",sqlDate,Integer.valueOf(evCnt),evGrp);
}
catch (Exception ex) {
System.out.print("Error, t1Home.create(): "+ex.getMessage());
}
}
I have no problem when testing on another table call TEST2 with the similar
schema. Just remove the last field GROUP from the schema. It works with no
error.
Can anybody help?
Thanks in advance,
phuwarin
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user