I'm currently in the process of learning the Play framework, but ran into some trouble pretty quickly.
I've got an independent Java project that uses Hibernate to persist and fetch data from a MySQL database. This project is full of DTOs and DAOs.
I thought it would be a good idea to reference the Hibernate project in my new Play framework project, and consequently take advantage of the different DAOs and DTOs through it.
Everything compiles in Eclipse, but when running my Play application in the browser I get an error that the package com.path.to.hibernate.project.package could not be found.
Is there a secret way to reference other projects in the Play framework or am I simply doing it wrong? I kind of like the idea of separating the Hibernate stuff from the Play framework stuff.
If you think I should be taking a different approach on this, I'm all ears.
Thanks.
EDIT:
build.sbt (equivalent of Build.scala?)
name := "klepp_rc_play"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
"mysql" % "mysql-connector-java" % "5.1.29"
)
play.Project.playJavaSettings
application.conf
...
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost/play"
db.default.user=****
db.default.password=****
ebean.default="models.*"
...
conf/META-INF/persistence.xml
<?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_2_0.xsd"
version="2.0">
<persistence-unit name="defaultPersistenceUnit"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<property name="hibernate.hbm2ddl.auto" value="create" />
</properties>
</persistence-unit>
</persistence>