ismetozalp / morphia-gwt Goto Github PK
View Code? Open in Web Editor NEWGwt extension for morphia
Gwt extension for morphia
I've a GWT 2.7.0 project with MongoDB Java Driver 3.0.2, Morphia 1.0.1 and Morphia-GWT 0.107.2.
I don't use Maven for build.
The class ObjectId_CustomFieldSerializer refeer to non existing properties _time, _machine and _inc of object org.bson.types.ObjectId.
Looking at the source of ObjectId.java from MongoDB Java Driver they seems not exixts anymore.
This cause ObjectId serialization errors.
I have made a jar from the sourcecode and put it into my gwt-project, along with morphia-0.107.jar (and the rest of the required libs).
Anyway, i get
[ERROR] [project] - Line 22: No source code is available for type org.bson.types.ObjectId; did you forget to inherit a required module?
what am i doing wrong?
In 1.0.0-rc3, the serializer for org.mongodb.morphia.Key is missing. Key has been updated in Morphia 1.x so the serializer needs some changes for it to be compatible. I am testing a local build which seems to work with the following code:
public static Key instantiate(SerializationStreamReader streamReader)
throws SerializationException {
Object id = (Serializable) streamReader.readObject();
String collection = streamReader.readString();
Class klass = (Class) streamReader.readObject();
return new Key( klass, collection, id);
}
public static void serialize(SerializationStreamWriter streamWriter, Key instance)
throws SerializationException {
streamWriter.writeObject(instance.getId());
streamWriter.writeString(instance.getCollection());
streamWriter.writeObject(instance.getType());
}
Hi guys,
Does anyone know when the first release of this component happen? hopefully into maven or somewhere I can download the jar from?
Regards
There is no fresh version on maven
Kind of question\howTo (move to wiki?)
ReastyGWT uses field for (de)serialization while Jackson uses geters\setters,
so here the unification- now we use filed on both sides:
@Provider
@Consumes({"application/*+json", "text/json"})
@Produces({"application/*+json", "text/json"})
public class AppResteasyJacksonProvider extends ResteasyJacksonProvider {
public AppResteasyJacksonProvider() {
super();
setMapper(create());
}
// Use Jackson field based serialization
private static ObjectMapper create() {
ObjectMapper mapper = new ObjectMapper();
VisibilityChecker<?> visibilityChecker = mapper.getVisibilityChecker()//
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)//
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)//
.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE)//
.withSetterVisibility(JsonAutoDetect.Visibility.NONE);
mapper.setVisibilityChecker(visibilityChecker);
return mapper;
}
}
another way is to use Jackson MixIns
Maybe it is possible to solve the problem on morphia-gwt side?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.