aspose file tools*
The moose likes JBoss/WildFly and the fly likes Database problem in JBoss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Database problem in JBoss" Watch "Database problem in JBoss" New topic
Author

Database problem in JBoss

Gopi Chand
Greenhorn

Joined: Feb 04, 2007
Posts: 24
Hi,

I am trying to use mysql 5.0 with jboss 4.2.3
I have created all the required configuration xml file.
and when i try to launch jboss it gives me an error saying :

Unable to get timer handles for containerId: jboss.j2ee:service=EJB3,ear=server.ear,jar=server.jar,name=UserManagerBean
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'test.timers' doesn't exist

since this is something related to the persistence of timer services, so i ignored it.

but my entity bean is also giving problem. the prblem is :

Unsuccessful: create table UserBean (id integer generated by default as identity (start with 1), name varchar(255), primary key (id))
17:16:35,000 ERROR [SchemaExport] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'generated by default as identity (start with 1), name varchar(255), primary key ' at line 1

from the error message what i could understand is that jboss is trying to create db scheme from entity beans and it is not able to.. but why?
I have my entity beans' primary key as int with @Id and @AutoGenerated annotation.. what could be wrong?

and how do i fix the timer error as well? Please help..

Thanks,
Gopi
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5772
    
    7

In your *-ds.xml file for MySQL, did you set the type-mapping:



JBoss In Action
Gopi Chand
Greenhorn

Joined: Feb 04, 2007
Posts: 24
I afraid i did not..
i will try that..

thank you very much..
Gopi Chand
Greenhorn

Joined: Feb 04, 2007
Posts: 24
Hi,

I tried what you said and after that I got another problem related to JMS, which i fixed by following https://www.jboss.org/community/docs/DOC-9335

and now i am getting another error:

19:03:01,531 INFO [STDOUT] adding user bean
19:03:01,687 WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
19:03:01,687 ERROR [JDBCExceptionReporter] Table 'test.userbean' doesn't exist

"adding user bean" message is from my remote stateless bean after which i call entityManager.persist(..), but that is throwing some error.

My standardjbosscmp-jdbc.xml has create-table tag set to true, so it is supposed to create table when no table exists.. I don't know why it is not working..

Thanks
Gopi Chand
Greenhorn

Joined: Feb 04, 2007
Posts: 24
when i manually create the table, it seems to work fine without any problem.. just wondering why automatic creation of db schema from bean is failing ??!?
Marcelo Pereira
Greenhorn

Joined: Jul 12, 2010
Posts: 1
Hi Gopi Chand. I know this is an old question. I've faced the same problem and found this thread.
Probably you've already found the solution, but I'll answer here in case of anyone come here searching for answers.
I solved the problem adding this to my persistence.xml:

<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
</properties>
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5772
    
    7

Marcelo, welcome to Java Ranch!

I rather doubt that Gopi is still waiting for a response after 2 years. Also, Gopi was using EJB 2.1, so I doubt that an answer related to EJB 3 would help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Database problem in JBoss
 
Similar Threads
JPA/Hibernate entity mapping error?
hibernate usage--sql syntax error
doubt regarding jdbc syntax error while creating a table
Problems using GenerationType.IDENTITY for in-memory databases
Identity function in HSQLDB