Hello Phuwarin,

'GROUP' is a reserved word. You shouldn't use it for column/table
names.

alex

Monday, January 06, 2003, 12:40:27 PM, you wrote:


PSsc> I'm encounter problem with unable to insert data to database with this
PSsc> error message.

PSsc> 17:15:42,373 ERROR [Test1EJB] Could not create entity
PSsc> java.sql.SQLException: Syntax error or access violation: You have an error
PSsc> in your SQL syntax near 'group) VALUES ('1041848142313', 'PROD',
PSsc> '2003-01-06 17:15:42', 5, 'G')' at line 1

PSsc> My process is having JSP to input data and call the session bean to insert
PSsc> data to the entity bean.

PSsc> I'm using JBoss 3.0.4, MySQL database

PSsc> #
PSsc> # Table structure for table 'test1'
PSsc> #

PSsc> CREATE TABLE `test1` (
PSsc>   `EVENT_NUM` varchar(13) binary NOT NULL default '',
PSsc>   `PRODUCT` varchar(10) default NULL,
PSsc>   `EVENT_DATE` datetime default NULL,
PSsc>   `PARTICLE_COUNT` int(5) default NULL,
PSsc>   `GROUP` varchar(5) default NULL,
PSsc>   PRIMARY KEY  (`EVENT_NUM`)
PSsc> ) TYPE=MyISAM;

PSsc> #
PSsc> # ejb-jar.xml
PSsc> #

PSsc>         <entity>
PSsc>             <description>Test1 Entity Bean</description>
PSsc>             <ejb-name>Test1EJB</ejb-name>
PSsc>             <local-home>lpc.Test1Home</local-home>
PSsc>             <local>lpc.Test1</local>
PSsc>             <ejb-class>lpc.Test1Bean</ejb-class>
PSsc>             <persistence-type>Container</persistence-type>
PSsc>             <prim-key-class>java.lang.String</prim-key-class>
PSsc>             <reentrant>False</reentrant>
PSsc>             <cmp-version>2.x</cmp-version>
PSsc>             <abstract-schema-name>Test1</abstract-schema-name>
PSsc>             <cmp-field>
PSsc>                 <field-name>eventNum</field-name>
PSsc>             </cmp-field>
PSsc>             <cmp-field>
PSsc>                 <field-name>product</field-name>
PSsc>             </cmp-field>
PSsc>             <cmp-field>
PSsc>                 <field-name>eventDate</field-name>
PSsc>             </cmp-field>
PSsc>             <cmp-field>
PSsc>                 <field-name>particle</field-name>
PSsc>             </cmp-field>
PSsc>             <cmp-field>
PSsc>                 <field-name>group</field-name>
PSsc>             </cmp-field>
PSsc>             <primkey-field>eventNum</primkey-field>
PSsc>         </entity>

PSsc> #
PSsc> # sessen bean
PSsc> #

PSsc>   public void insertTest1(String evCnt, String evGrp) {
PSsc>     String timeMilli = String.valueOf(System.currentTimeMillis());
PSsc>     Test1Home t1Home;
PSsc>     Test1 t1Rec;
PSsc>     java.sql.Date sqlDate = new java.sql.Date(System.currentTimeMillis());
PSsc>     try {
PSsc>       // Lookup Test1Home
PSsc>       InitialContext ic = new InitialContext();
PSsc>       t1Home = (Test1Home)ic.lookup("Test1Home");
PSsc>       t1Rec =
PSsc> t1Home.create(timeMilli,"PROD",sqlDate,Integer.valueOf(evCnt),evGrp);
PSsc>     }
PSsc>     catch (Exception ex) {
PSsc>       System.out.print("Error, t1Home.create(): "+ex.getMessage());
PSsc>     }
PSsc>   }

PSsc> I have no problem when testing on another table call TEST2 with the similar
PSsc> schema. Just remove the last field GROUP from the schema. It works with no
PSsc> error.
PSsc> Can anybody help?

PSsc> Thanks in advance,
PSsc> 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

Reply via email to