title: Why is Scala searching persistence.xml instead of hibernate.cfg.xml?
body: <p>I'm not expert on hibernate, but I'm trying to learn it with Scala. So far I could only find hibernate documentation with Java, but no scala.</p>
  
  <p>My confusion is about when I should use persistence.xml, and when an hibernate.cfg.xml.</p>
  
  <p>I have this doubt because I see examples with both, and my code is sometimes complaining about not finding persistence.xml, and when it finds it then again complains about not finding hibernate properties...so I feel confuse. I feel a kind of friction between Scala/Java or different standards...</p>
  
  <p>Any suggestion?</p>
  
  <p>This is my main app:</p>
  
  <pre><code>package nl.busa.jpa
  
  
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  
  object HibernateJpaScalaTutorial {
      var entityManagerFactory: EntityManagerFactory = Persistence.createEntityManagerFactory("nl.busa.jpa.HibernateJpaScalaTutorial")
      var entityManager: EntityManager = entityManagerFactory.createEntityManager()
  
  def main(args: Array[String]) {
  
      entityManager.getTransaction().begin()
      entityManager.persist(new Buddy("Natalino", "Busa"))
      entityManager.persist(new Buddy("Angelina", "Jolie"))
      entityManager.persist(new Buddy("Kate", "Moss"))
      entityManager.getTransaction().commit()
  
      entityManager.getTransaction().begin();
      val allBuddies = entityManager.createQuery("From Buddy", classOf[Buddy]).getResultList
      println(allBuddies);
  
      entityManager.close();
  }
  }
  </code></pre>
  
  <p>This is my hibernate.cfg.xml</p>
  
  <pre><code>&lt;?xml version = "1.0" encoding = "utf-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration SYSTEM
              "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  
  &lt;hibernate-configuration&gt;
  &lt;session-factory name="hibernate.cfg.xml"&gt;
      &lt;property name = "hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
      &lt;property name = "hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
      &lt;property name = "hibernate.connection.url"&gt;jdbc:mysql://localhost/test&lt;/property&gt;
      &lt;property name = "hibernate.connection.username"&gt;root&lt;/property&gt;
      &lt;property name = "hibernate.connection.password"&gt;&lt;/property&gt;
      &lt;property name="hibernate.hbm2ddl.auto"&gt;create"&lt;/property&gt;
  &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>And my error message is this:</p>
  
  <blockquote>
    <p>Could not find any META-INF/persistence.xml file in the classpath</p>
  </blockquote>