Beiträge getagged mit OpenJPA

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 [...]

, ,

Keine Kommentare

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 [...]

, ,

Keine Kommentare

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) { [...]

, , ,

Keine Kommentare