• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database connection using JBoss Seam & JBoss Tools for Eclipse

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I want to learn JBoss Seam using few books I bought. I'm quite new to Java EE and have only done a little bit using JSF. Nevertheless I read what the Seam framework does and think this is what I want to do.

I understood the main concept of JSF and Seam, but I can't get any database example to work. I am using JBoss Tools for Eclipse to generate the (EAR) projects and using MySQL as database backend.

What I didn't understand yet: Do I have to create the database tables or will the EJB component of Seam will do that from the entity beans?

I tried both, but it didn't work. I can't even get the registry example working. The errors vary, sometimes it is "javax.el.PropertyNotFoundException" and "Target unreachable" and sometimes it is "javax.ejb.EJBTransactionRolledbackException: Unknown entity".

There must be something I am doing wrong:

1) Creating a new EAR project using JBoss Tools
2) Choosing an existing MySQL database as data source (ping successful)
3) Creating a new entity bean using @Name, @Entity like



4) Create a new java class using @Stateless and @Name, as well as a manager class like



Where might be my mistake?

Thank you so much in advance!
 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually JBoss provide a Data Source XML file you have to edit to set your database specifics. Have you looked at the JBoss AS Admin Guide?
 
Peter Irmstadt
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your answer!

Eclipse generates a file "projectname-ds.xml" that is deployed to the JBoss AS and should be a replacement for a direct server configuration shouldn't it?

I sometimes read about a file "persistence.xml". What is that file about? It isn't generated automatically by JBoss Tools. Do I need it?
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you have set up your JBoss first copy the server/default folder into your server/project folder or just rename the default folder into your project folder. Now you can create a mysql-ds.xml data source file. I don't know what the persistence.xml is. Which JBoss version do you use?
 
Peter Irmstadt
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What server/project folder do you mean?

I use the JBoss AS version 4.2.3.GA as well as the newest version 5.
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know JBoss 5 but for JBoss 4.2.X you have a server directory once you installed your JBoss. The server directory contains a default directory (name default) which you can either rename to your project name or whatever name you like. Or you can copy and paste that default directory and rename it too.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic