-
1. Re: 2 jars , no inject
nicola9000 Aug 26, 2006 2:35 PM (in response to nicola9000)Corrige application.xml
[module]
[ejb]M2U_InstalledBaseManager-ejb.jar[/ejb]
[module]
[module]
[java]M2U_Data-ejb.jar[/java]
[/module]
( so is the same )
[module]
[ejb]M2U_Data-ejb.jar[/ejb]
[/module] -
2. Re: 2 jars , no inject
nicola9000 Aug 27, 2006 10:14 AM (in response to nicola9000)Solved
i put in the .jar
seam.properties
META-INF/ejb-jar (for interception)
META-INF/persistence.xml
with different name of persistence-unit-name !!!!
(NO jboss-seam.jar)
i will think if it is useful to deploy a single .ear with all database components, and if it is possible.
For now is ok so.
Nicola -
3. Re: 2 jars , no inject
mzeijen Aug 28, 2006 3:22 AM (in response to nicola9000)Yeah, I am also very curious if it is possible to deploy the data (entity) layer in a different ear file.
I have the feeling that it isn't possible, because how should SEAM now how to get the correct JNDI path for the entities. You can only configure one JNDI path where the components should be fetched. -
4. Re: 2 jars , no inject
nicola9000 Aug 28, 2006 6:52 PM (in response to nicola9000)"mzeijen" wrote:
I have the feeling that it isn't possible, because how should SEAM now how to get the correct JNDI path for the entities. You can only configure one JNDI path where the components should be fetched.
@Name("")
@LocalBinding(jndiBinding="")
@JndiName("")
perhaps ?
I will study better Ejb3-jndi ASAP and i will solve it and i will post :)
I have to improove with all new staff before it.
GoodWork
ciao Nicola -
5. Re: 2 jars , no inject
mzeijen Aug 29, 2006 2:57 AM (in response to nicola9000)I just read from a different topic (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=89223) that I started that it isn't possible to resolve entity beans over JNDI but that you have to add them to each ear project.
I already got this working but there is a trapdoor. Each ejb jar that needs to be able to work with the entity-manager needs a persistence.xml. The problem lies in the ejb jar that doesn't house the entity classes but only uses them. In the persistence.xml in this ejb you need to define, next to the datasource, which classes are entity classes. Normally the easiest way to do this is as following:<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="MyEntityManager" transaction-type="JTA"> <jta-data-source>java:/MyDS</jta-data-source> <jar-file>../dataEJB.jar</jar-file> <properties></properties> </persistence-unit> </persistence>
The jar-file property links to the jar file where the entity beans can be found. The entityManager should scan this jar for the entities and the problems is solved. But because of a bug in the jboss implementation of ejb3 the path to the jar file isn't resolved correctly.
Luckily there is another way to define the entity classes. It isn't pretty but the only solution until they fix the bug (I hope they will do that soon). By using the class tag you can define each class that are entity classes:<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="MyEntityManager" transaction-type="JTA"> <jta-data-source>java:/MyDS</jta-data-source> <class>my.package.User</class> <class>my.package.SomeOtherEntity</class> <properties></properties> </persistence-unit> </persistence>
I hope this prevents hours of work ;).