[Persistence, JBoss/CMP, Hibernate, Database] - Re: jboss-4.2.3.GA with MySQL Server 5.0 configuration probl
by PeterJ
It appears that you did not install JBoss Messaging properly. How did you install it? (I asked this before, you never answered.) Did you run the installation script that comes with it?
The error you are getting is due to pieces of JBossMQ still being present.
To install JBoss Messaging and convert it to use MySQL, you need to:
1) Run the install script, [jboss_messaging]/util/release-admin.xml, it will remove JBossMQ and copy all the files to support JBoss Messaging. (I tried to find the notes for how to run this but did not see them, they are not in the readme.html but they might be on the wiki.)
2) Create a *-ds.xml file for MySQL (instructions are in the wiki, I already gave you the link). Do NOT use "DefaultDS" as the JNDI name unless you want to make a lot of other configuration changes; use amother name such as "MessagingDS".
3) Replace the deploy/jboss-messaging.sar/hsqldb-persistence-service.xml file (I hope I got this directory name correct) with the mysql-persistence-service.xml file from the [jboss_messaging]/examples/config directory. Edit this file to use the JNDI name you chose in step 2. The name appears several time, you will have to change it in every location.
I think that is it.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4174386#4174386
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4174386
17 years, 10 months
[EJB 3.0] - About best practises & the use of EntityManager
by bdelbass
Hello.
I am currently working on a J2EE/EJB3/Seam project and I have several questions :
1. Sometimes I need to perform queries in EJBQL such as "select s from Service s where s.index=?" to find entities using an unique index which is not the primary key. Such queries have to be performed several times so I have created a method named findServiceUsingIndex(String index). Where is the best place to put that method ? My boss tells me I should not put it into the code of the Service entity. Any pros/cons? Shall I put it into a stateless bean? What is the best practise?
2. One of my tasks consists in exporting data from the entities to a text file (and to import data from text files and to update the entities). The entry point of the processing is a stateless bean that has an EntityManager annotated with @PersistenceContext. Because the processing it quite complex, I have also splitted the code that processes files into many classes, packages that are only POJOs, not entities neither beans (because they do not really need to be exposed as beans). But because they are not beans, these POJOs cannot use the @PersistenceContext annotation and thus need to get the EntityManager by another way. Therefore, I have passed the EntityManager as first argument to the methods that need to find or persist entities. My boss thinks passing an EntityManager as a parameter to methods (not constructors) of -plain old- java objects is not good and may interfere with JBoss (and wants me to convert all my POJOs to beans which means creating a lot of interfaces). I think there is no problem because the objects are just POJOs, and these methods do not cache the EntityManager (they just use the EntityManager to perform their job and then forget about it) and all the process is done within one thread. Do you have any opinion on that?
Thanks in advance for your answers.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4174380#4174380
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4174380
17 years, 10 months