Results 1 to 3 of 3

Thread: Error: configure Could not find persistence.xml

  1. #1
    Join Date
    May 2009
    Posts
    2

    Default Error: configure Could not find persistence.xml

    Hi All,

    I am trying to test the following code:

    Code:
    @Transactional
    public void updateT(Testtbl pTest) { 
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("test"); 
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    em.createNativeQuery( "UPDATE Testtbl e SET e.firstName = 'xxx'").executeUpdate(); 
    em.getTransaction().commit();
    em.close();
    emf.close();
    }

    As you can see this method may update my Testbl table, but when I run the project, the websphere consol returns the following error:

    Code:
    org.hibernate.ejb.Ejb3Configuration configure Could not find any META-INF/persistence.xml file in the classpath
    The file where I configure the persistence is named META-INF/spring-persistence.xml

    my spring-persistence.xml is the following:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    	<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
    		<!--  provider -->
    		<provider>org.hibernate.ejb.HibernatePersistence</provider>
    		<properties>
    			<property name="hibernate.show_sql" value="true"/>
    			<property name="hibernate.format_sql" value="true"/>
    			<property name="use_sql_comments" value="false"/>
    			<property name="hibernate.dialect" value="org.hibernate.dialect.InformixDialect" />
    		</properties>
    	</persistence-unit>
    </persistence>
    Any help will be greatly appreciated.
    Thanks and Regards,

    Student

  2. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Afaik you cannot arbitrarily name this file as it is specified to be "META-INF/persistence.xml". So I suggest giving it its default name and things should work as expected.

    Regards,
    Andreas

  3. #3
    Join Date
    May 2009
    Posts
    2

    Default

    Ok, I'll try it.
    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •