Maxired
unread,Nov 10, 2011, 8:10:40 AM11/10/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to resthub-dev, res...@maxired.fr
Hi all,
I am currenlty working on a project whose primery goal is to provide
"Backend as a Service".
I am posting there because this projec is built over Resthub Java. I
am using the last Release, resthub 1.1.2.5
The first step is to create a Generic Stack whose goal is to create/
get/update/delete any object, without any specific code linked to the
object :
If we want to be able to deal with a new kind of entity, we just need
to create the new entity Class.
It is important to mention that I am using a SQL database, mainly
because I didn't want to deal with any database configuration or
drivers settings, ...
I got currently a working prototype which is working with any simple
object, ie only composed by basic Type or serializable object.
To do so, all the entity that we deal with have to extend a Root
entity composed by an Id and a HashMap. It is in this HashMap that all
other object attribut are saved.
Here is an extract of the getter corresponding to the HashMap
for(Field field : this.getClass().getDeclaredFields()){
try{
if(field.getName().indexOf("_")!=0 ){
//field of the Root Object begin
with "_"
_parameter.put(field.getName(),
field.get(this));
}
}catch(java.lang.IllegalAccessException e){
_parameter.put(field.getName(), null);
}
}
For completeness, I should also say that I'm aiming to work with
Dynamic Class reloading. I got also this feature working in the same
condition. In order to retrieve object - saved in the database - whose
model is not up to date (some fields deleted by example), I am once
again playing with the HashMap : When we ask for the object, we don't
give the object but the HashMap. This is working fine in JSON which is
the output that I'm aiming in a first time. (If you want some more
information about his, please ask me)
The next step would be to be able to save relation between object.
To do so, I'm thinking to override the service method (Currently I am
using only the Resthub Generic service layer), but I think this might
be usefull that I got your advice before going further.
I'm a afraid that I need to basically do yet another ORM.
In my service layer, I would need to check all the field of my object,
if one of this field extends my Root object, deal with it (save,
retrieved, ...) , and do so until all fields are processed.
I would also need to do this for Collections, Array, and I'm pretty
sure for some more thing that I'm not yet thinking about.
What do you think ? Is there any simple project which could help me
there ?
Should I rather wait for the next version of RESThub ? Would Spring-
data help me to do so ?
Best regards,
Maxired