Code Monkey home page Code Monkey logo

jpa-for-scala's Introduction

JPAExtension

JPA

JSR 317: JavaTM Persistence 2.0 (JPA 2.0) is s a POJO persistence API for object/relational mapping. It contains a full object/relational mapping specification supporting the use of Java language metadata annotations (and/or XML descriptors) to define the mapping between Java objects and a relational database.

The definition of persistent entities, relations, interceptors etc. is annotation based (if you do not use the XML descriptors). Only dependent from the standard package javax.persistence . This allows to choose different JPA implementations/providers like:

All of them do provide additional rich feature enhancements like PostGIS syntax, compile time entity enhancement, plug-able extensibility etc.

JPAExtension

JPAExtension does provide

  • a Scala interface to the base JPA classes EntityManager, EntityMangerFactory, Query etc. to ease their usage
  • Transaction scope and query wrapper to mesh better with Scala’s FP
  • more type safe interface using Scala’s type system
  • externalized query and filter class definition (dedicated XML file)
  • Query parameter holder classes for type safe binding

I know that the most challenging thing is to provide working Scala implementations (suitable for Java Reflection API’s expectations). I will try to collect as many examples as possible for the common issues. (If you have one, contact me.)

The JPAExtension is available at Scala-Tools Maven Snapshot Repository
and it will be available at the Snapshot Documentation Site soon.

For now please visit the short blogposts (blog.fakod.eu/tag/jpa/ ) I wrote to get an impression of JPAExtension and Scala entities.

And as usual: Follow me on Twitter

Maven

To use JPAExtension simple put the following dependency in your pom.xml

	</dependencies>
	  <dependency>
	    <groupId>org.scala-libs</groupId>
	    <artifactId>jpaextension</artifactId>
	    <version>0.0.2-SNAPSHOT</version>
	  </dependency>
	</dependencies>

Planned

The JPA Extension should support

jpa-for-scala's People

Contributors

fakod avatar

Stargazers

Alexandr Oshlakov avatar 不如 avatar Lachlan O'Dea avatar Alexander Korneev avatar Kenton Gray avatar Konstantin Kirillov avatar  avatar libby kent avatar  avatar  avatar German Viscuso avatar  avatar Örjan Angré (Lundberg) avatar  avatar Satish Bhat avatar jinuc avatar Jason Wynn avatar Sean Gao avatar Martin Grotzke avatar Odd Möller avatar Derek Chen-Becker avatar Flinn Mueller avatar yasushi abe avatar

Watchers

 avatar James Cloos avatar

Forkers

lidaling

jpa-for-scala's Issues

Handle Enumerations

I would be great if you could bundle a extension or sugar method that can handle mappings between scala enumerations and JPA enums i.e.

object UserType extends Enumeration {
type UserType = Value
val CUSTOMER = Value("Customer")
val EMPLOYEE = Value("Employee")
}

cannot currently be mapped directly using @Enumerated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.