JBoss 5.1: sleep mode with JPA

I have two questions to ask regarding JBoss 5.1. We are in the process of moving from JBoss 4.2 to JBoss 5.1.

We also use Java 1.6 and JPA 2.0 with Hibernate 3.6 as a provider.

My questions:

  • Is it possible to use Hibernate 3.6+ with JBoss 5.1. If so, how?
  • What about JPA 2.0? I know that JBoss 5.1 comes with JPA 1.0 compatibility. Can we use JPA2?

And since we cannot perform any configuration to install JBoss, all corrections should be performed only in our application.

Thanks in advance, JassB

+6
hibernate
source share
3 answers

Do it:

1) Add jboss-classloading.xml to / src / main / webapp (I use Maven):

Content:

<?xml version="1.0" encoding="UTF-8"?> <classloading xmlns="urn:jboss:classloading:1.0" domain="$UNIQUE_DOMAIN_NAME" export-all="NON_EMPTY" import-all="false" parent-first="false"> </classloading> 

2) Change $ JBOSS_INSTALL_DIRECTORY / jboss-as / server / $ PROFILE / conf / bootstrap / deployers.xml and add the following at the end:

 <bean name="IgnoreFilesDeployer" class="org.jboss.deployers.vfs.spi.deployer.AbstractIgnoreFilesDeployer" </bean> 

3) Create the JBOSS-IGNORE.TXT file in the META-INF folder with the following contents:

WEB-INF / classes / META-INF / persistence.xml

4) I renamed my persistence.xml to spring -persistence.xml and added this file to context.xml as:

 <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceXmlLocation" value="classpath:/META-INF/spring-persistence.xml"/> .... </bean> 

5) I also changed spring -persistence.xml (saved persistence_2_0.xsd file in webapp \ META-INF folder) as

  <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="file:///persistence_2_0.xsd http://java.sun.com/xml/ns/persistence"> .... </persistence> 
+2
source share

I got the same problem today, and having tried many alternatives and asking everywhere, the answer is no

You cannot use JPA 2.0 with Jboss 5.1 (even if you cannot change the server configuration)

But I saw hibernate3.X working on Jboss5.1, but never with annotation features: just the old way to configure XML.

Now, in my opinion, you have 2 solutions: either ask for a server update, or change your data access system with the old way.

+3
source share

I have the same problem, this link saved my life:

https://community.jboss.org/wiki/classloadingconfiguration

I suggest looking at "Isolation with Overriding Server Classes"

0
source share

All Articles