Beiträge getagged mit JPA
Scala Case Class as JPA EmbeddedId
It is a good idea to use case classes as EmbeddedId class. Id classes can be used to specify an embeddable composite primary key class owned by the entity (more…). Scala Case classes provide a default equals and an “automatic” generation of class properties. So lets create a really simple example Entity Class OSEmbeddedId. @Entity [...]
Constructor Arguments with JPA-Annotations
Scala provides the possibility to define constructor argument that are class properties as well. I recoded the entity OrganisationAssociation to use j__organisations as argument. The example entity from my post Relations with Scala Collections and JPA looks like this: @Entity @Table(name = “org_assoc”) @SequenceGenerator(name = “org_assoc_id_seq”, sequenceName = “org_assoc_id_sequence”) class OrganisationAssociation extends MIPEntity { @Id [...]
Relations with Scala Collections and JPA
Java Collection JPA’s One to Many and Many to Many relations require an attribute of type java.util.Collection like it is shown in the next example. This will be normally a List interface and a ArrayList implementation. … @OneToMany public Collection organisations = new ArrayList() … Unfortunately the Scala Library has a different interface concept that [...]
Scala Entity and JPAExtension Examples (JPA 2.0)
I am using: a Mapped Superclass for all basic entities (MIPEntity) a pre persist entity listener to change some values the following hierarchy: MIPEntity . . . // do something with oi } withQuery (filter) Apply function on entity got by find (BigInteger as primary key). Type is inferred by oi: ObjectItem again: findAndApply(id) { [...]
JPA For Scala
JPAExtension (JPA for Scala, ORM for Scala) should: be fully JPA 2.0 compliant Persistence Layer and Object Relational Mapper (ORM) for Scala perfectly replace the Java API with Scala Collections and other niceties support Transaction Scope Wrappers with Scalas Functional Programming abilities JPAExtension is hosted on Github Related Artikel are: Constructor Arguments with JPA-Annotations Relations [...]
Wrapping JPA Queries
I love the “pattern” used in this post (which I got from here). Working with JPA queries I tried to follow the same pattern. In a REST resource I needed to query for one entity and change the location attribute. [UPDATE] This is mostly realized here [UPDATE] The code that visually separates the query from [...]

Twitter
Xing
Facebook