All posts in TRIMM JPA

We have just added an example of how to use TRIMM JPA to generate code for Hibernate 4.x (in this case 4.2.4) to our TRIMM-Examples repository. The project is called TrimmHibernate4xMDDExample.

If you are new to TRIMM JPA, check out this tutorial on how to use it

The largest difference from the Hibernate 3.6.x example, called MDDExample, are the following:

  • To Persist DateTime and LocalDate (from JODA time) – we now use org.jadira.usertype.usertype.core and the latest joda-time version.
    This means that we have removed the dependency to joda-time-hibernate.
  • We have therefore added the following Maven jar dependency:

           <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>2.2</version>
            </dependency>
            <dependency>
                <groupId>org.jadira.usertype</groupId>
                <artifactId>usertype.core</artifactId>
                <version>3.1.0.CR8</version>
            </dependency>
          

    Read more

TRIMM JPA will leave table and column names up to the default JPA rules, unless you instruct it to specify @Table, @JoinTable, @Column, @JoinColumn, et, e.g. using the addTableAndColumnNames parameter in the JPA YAML configuration.

It can sometimes be useful to control the table and column names if the default names (which follows the JPA default naming standard) collide with database reserved words or if you use a “modern” database like Oracle which still limits names to 30 characters 😉
Read more