0

I'm trying to integrate Batoo JPA in one of my projects using gradle and Jetty as a server. What libraries do I have to integrate? Is there a sample available?

Currently I have these:

'org.batoo.jpa:persistence-api:2.0',
'javax.validation:validation-api:1.0.0.GA',
'com.jolbox:bonecp:0.8.0-rc1'

But these appear not to be enough. Before going further with "trial and error" I'd wanted to ask here at stackoverflow first, what libraries I need to get started with Batoo Jpa (together with gradle and Jetty).

Thanks

Soccertrash
  • 1,830
  • 3
  • 28
  • 48

1 Answers1

2

In one basic project i made, i had to configure these libraries:

-batoo-annotations-2.0.1.0-RTM.jar
-batoo-annotations-2.0.1.0-RTM-sources.jar
-batoo-jdbc-2.0.1.0-RTM.jar
-batoo-jpa-2.0.1.0-RTM.jar
-batoo-jpa-spi-2.0.1.0-RTM.jar
-jpql-0.1.6.jar
-parser-2.0.1.0-RTM.jar
-persistence-api-2.0.jar
-guava-14.0.1.jar
-commons-lang-2.6.jar
-validation-api-1.0.0.GA.jar
-bonecp-0.7.1.RELEASE.jar
-commons-dbutils-1.5.jar
-commons-io-2.4.jar
-asm-3.3.1.jar

-h2-1.3.171.jar  <-- I add this one as database driver it could be changed.

If you have problem with transactions (if i remember correctly Batoo raise exceptions if you don't have a transaction control, but you can test it) i configured these libraries in order to have a CDI transaction control, but you can omit these if you want to use spring or Batoo does works well without a transaction control :-)

-deltaspike-cdictrl-api-0.3-incubating.jar
-deltaspike-cdictrl-weld-0.3-incubating.jar
-deltaspike-core-api-0.3-incubating.jar
-deltaspike-core-impl-0.3-incubating.jar
-deltaspike-jpa-module-api-0.3-incubating.jar
-deltaspike-jpa-module-impl-0.3-incubating.jar

-weld-api-2.0.0.jar
-weld-spi-2.0.0.jar
-weld-se-2.0.0.jar

Now, remember that Batoo uses standard properties in the persistence.xml file, like this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"  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">
<persistence-unit name="your PU name" transaction-type="RESOURCE_LOCAL">
    <provider>org.batoo.jpa.core.BatooPersistenceProvider</provider>

    <class>here.you.add.your.Entities</class>

    <properties>
                    <!-- here your driver-->
        <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
                    <!-- here the URL of your database-->
        <property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/~/test" />
                    <!-- here your username-->
        <property name="javax.persistence.jdbc.user" value="sa" />
                    <!-- here your password-->
        <property name="javax.persistence.jdbc.password" value="" />
    </properties>
</persistence-unit>

Hope this helps, cheers :-)

n3k0
  • 577
  • 14
  • 40