db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost/my_database"
db.default.user=***
db.default.password="****"
db.default.jndiName=DefaultDS
hibernate.use_sql_comments=true
<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.hbm2ddl.auto" value="update" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
</properties>
</persistence-unit>
public T findById(Long id) {
try {
T obj = JPA.em().find(getPojoClass(), id);
return obj;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
I've found my configuration error.
In my application.conf file was missing:
jpa.default=defaultPersistenceUnit
I tried many configurations found in blogs. But now it is working pretty well.
[]'
Sidnei
--
Sidnei Basei
twitter.com/SidneiBasei
Facebook.com/SidneiBasei
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/0rqEYDmp-0oJ.
> To post to this group, send email to play-fr...@googlegroups.com (mailto:play-fr...@googlegroups.com).
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com (mailto:play-framewor...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
My configuration is like yours. Please, check your project/Build.scala file:
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val appName = "EncontreQuadras"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
// Add your project dependencies here,
"postgresql" % "postgresql" % "8.4-702.jdbc4",
"org.hibernate" % "hibernate-entitymanager" % "4.1.1.Final",
"org.hibernate" % "hibernate-core" % "4.1.1.Final",
"org.hibernate" % "hibernate-validator" % "4.2.0.Final"
)
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
// Add your own project settings here
)
}
[]'s
Sidnei
--
Sidnei Basei
twitter.com/SidneiBasei
Facebook.com/SidneiBasei
> > twitter.com/SidneiBasei (http://twitter.com/SidneiBasei)
> > Facebook.com/SidneiBasei (http://Facebook.com/SidneiBasei)
> > > To view this discussion on the web visithttps://groups.google.com/d/msg/play-framework/-/0rqEYDmp-0oJ (http://groups.google.com/d/msg/play-framework/-/0rqEYDmp-0oJ).
> > > To post to this group, send email to play-fr...@googlegroups.com (mailto:play-fr...@googlegroups.com).
> > > To unsubscribe from this group, send email to play-framewor...@googlegroups.com (mailto:play-framewor...@googlegroups.com).
> > > For more options, visit this group athttp://groups.google.com/group/play-framework?hl=en.
> >
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.