« 29.2. | Main | Gin Basil Smash »

Donnerstag, März 01, 2012

State of Play

Ach ja: roo 1.2 bedingt -> GAE 1.6.0 mit datanucleus-appengine plugin 2.0.0-RC2 welches datanucleus 3.0.4 welches JPA 2.0 braucht: ätz...

Die GAE-datanucleus-Integration scheint überschattet und aktuell stark limitiert zu sein:

Unowned relations sind plötzlich nicht möglich:

testCountCustomers(de.tixus.mb.roo.gwt.shared.domain.CustomerIntegrationTest): Error in meta-data for field de.tixus.mb.roo.gwt.shared.domain.Staff.id : Cannot have a primary key of type java.lang.Long and be a child object (owning field is "de.tixus.mb.roo.gwt.shared.domain.Customer.servedBy").; nested exception is javax.persistence.PersistenceException: Error in meta-data for field de.tixus.mb.roo.gwt.shared.domain.Staff.id : Cannot have a primary key of type java.lang.Long and be a child object (owning field is "de.tixus.mb.roo.gwt.shared.domain.Customer.servedBy").

testFindCustomer(de.tixus.mb.roo.gwt.shared.domain.CustomerIntegrationTest): java.lang.Long cannot be cast to java.lang.Integer

Datanucleus weiss das und schlägt was vor, aber das hört sich kompliziert an:

By default in GAE/J all relations are owned meaning that any child objects have the parent object Key as part of their Key, and persisted as part of the same entity-group. This is obviously useful in optimising retrieval of data, but there are times when you simply want your model persisting and not have imposition of ownership. In v2 of the plugin you can have unowned relations, where each object is in its own entity-group. To define a relation like this, see the following example

@PersistenceCapable
public class A {
@Persistent(primaryKey="true", valueStrategy=IdGeneratorStrategy.IDENTITY)
long id;

@Unowned
B b;
}

@PersistenceCapable
public class B
{
@Persistent(primaryKey="true", valueStrategy=IdGeneratorStrategy.IDENTITY)
long id;

@Unowned
@Persistent(mappedBy="b")
A a;

String name;
}

So when we persist an object of type A with related B it will do the following:
PUT the A, generating its Key, but without property for B
PUT the B, generating its Key, and with a property referring to the key of A
PUT the A with the property referring to the key of B.

Jesus!

DIe JPA 2.0-Integration hat einen bug: "Result class is simple, but field value [Ljava.lang.Object;@135afd61 not convertible into that;"

Darin (verständliches) fehlendes GAE-Commitment der roo-Leute:

Given that GAE and GWT are not high on our priorities due to their restrictions of what you can do, we are expecting GAE to allow JPA 2.0 compliant applications to run like other platforms such as EclipseLink and Oracle for example.

Für eclipse fehlen die GAE, GWT runtimes

<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>

Kann man per Hand hinzufügen, aber dasroo-plugin schmeisst sie immer raus:
Roo regenerates gwt-maven-plugin in pom.xml deleting edits done by the user

Erstellt von tixus um 12:57 PM Kategorien: Software + Java
Powered by
Thingamablog 1.1b6