java - Jboss AS 7 Hibernate Configuration -


i'm trying configure hibernate in jboss 7.1.1

i put persistence.xml in web-inf folder

<?xml version="1.0" encoding="utf-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="actionbazaar" transaction-type="jta">    <provider>org.hibernate.ejb.hibernatepersistence</provider>    <jta-data-source>java:/actionbazaards</jta-data-source>    <properties>       <property name="hibernate.show_sql" value="true" />    </properties> </persistence-unit> </persistence> 

obs: jboss 7.1.1 have module hibernate 4 , have datasource named java:/actionbazaards

but error:

can't find persistence unit named actionbazaar in deployment "actionbazaar.war" 

when try use:

@persistencecontext(unitname="actionbazaar") private entitymanager entitymanager; 

you trying configure hibernate jboss 7.1.1 , if using mysql database, start following answer: how configure hibernate in jboss

your hibernate configuration done jboss 7.1.1.

after deploy projetc....

if no persistence provider entitymanager error occurred while deploying project add 1 class in project class hibernateutil.java , provide persistence unit name entitymanagerfactory = persistence.createentitymanagerfactory("abc");

public class hibernateutil {      private static final entitymanagerfactory entitymanagerfactory;     static {                 try {                      entitymanagerfactory = persistence.createentitymanagerfactory("abc");                      system.out.println("entity menager test.............."+ entitymanagerfactory);                 } catch (throwable ex) {                      system.err.println("initial sessionfactory creation failed." + ex);                     throw new exceptionininitializererror(ex);                    }     }  public static entitymanagerfactory getentitymanagerfactory() {          return entitymanagerfactory;     }  } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -