facebook

Gwt Scaffolding for 2.0.4 problem. No details

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #349447 Reply

    totoheros
    Member

    Hi all,

    I have generated a gwt Scaffolding for 2.0.4.
    I try to reuse the web part in a current gwt version. I just added a not too recent gwt-incubator.jar in order to compile.

    Things are ok except I dont get the details from a 1-n relation.
    You can see the result at http://gwtbean.appspot.com/

    I dont know if the problem come from the use of Scaffolding for 2.0.4 or if I missed something in the generation.

    I used this 2 beans as the input :
    public class Substance {
    Integer id;
    String name;
    }

    public class InteractionCYP {
    Integer id;
    Integer idSubstance;
    String cytochrome;
    }

    So from a substance I expect to see n InteractionCYP’s

    Do I need to add the relation (ArrayList<InteractionCYP> interactions) in the Substance class ? or something else ?

    Thanks in advance for any help.

    Pierre

    #349449 Reply

    support-swapna
    Moderator

    Pierre,

    I am afraid this is a GWT development query. I suggest you cross post to GWT or development related forums like stackoverflow.com for better support on this query.

    Hope it helps

    #349451 Reply

    totoheros
    Member

    It could be GWT problem but I would like to know if I did the correct way for the scaffolding.

    How can I be sure that the generator understand my 1-n relation and shows it correctly ?
    From you tutorial,it seems that the payments are seen from a customer.
    In my exemple, how can I set that InteractionCYP.idSubstance = Substance.id for this relation ? So that I could see all InteractionCYPs for a Substance.

    Is there a documentation how the classes are generated ?

    Thanks in advance

    #349465 Reply

    totoheros
    Member

    Hi

    I am now 100% sure that it is not a gwt problem but a configuation for scaffold generation.

    I have suceeded to make it work (img attached)

    I ran the test with the client/payments derby base and I saw that some code was missing in my example test.

    at list “ClassA”RelationshipsEditor, “ClassA”RelationshipsWidget and “ClassA”ServiceImpl didnot take care of the 1- n relationship.

    So my question is still the same :

    How to the force the scaffold generator to take care of the 1-n relationship when using JavaBean ?

    I have an additionnal question :

    Seeing the look of my app ( image attached), I can guess that I missed some css, js from the generated.
    What shoud I import to get the same look ?

    Thank in advance

    Attachments:
    You must be logged in to view attached files.
    #349490 Reply

    support-swapna
    Moderator

    Pierre,

    Unfortunately we do not have a tutorial for scaffolding using java beans and which shows how the classes are generated.

    Below is the wizard which allows you to check the parent object. The unchecked objects are treated as associated objects.

    For the missing css files, unless we see your project, its hard to pin point the missing css files. Please attach the .zip file of your project to help us investigate further.

    #349540 Reply

    totoheros
    Member

    Thanks, really great product !

    I was abled to generate the relation also with javabean.
    I just had a set representing the n relationships :

    public class Substance {
    Integer id;
    String name;
    Set<InteractionCYP> interactions;
    }

    public class InteractionCYP {
    Integer id;
    Integer idSubstance;
    String cytochrome;
    }

    One more question :

    Create and update goes to the same method in my servlet :
    StoreSubstanceResponse execute(gwt.substance.client.actions.StoreSubstance action);

    How can I know if it is a new object or an object to update ?

    Pierre

    #349551 Reply

    support-swapna
    Moderator

    Pierre,

    The execute method is where all the client’s requests are handled.
    If you want to differentiate between a create and update, you can try on these lines :

    Ex :
    if(null == substance.getId()) {
    substanceService.addSubstance(substance);
    }
    else {
    substanceService.updateSubstance(substance);
    }

    For development related queries, I suggest you look at development related forums for better support.

    Hope this helps.

    #349566 Reply

    totoheros
    Member

    Hi,

    I still have a problem with id propagation.

    When a Substance is created, I receive a bean :
    GWTSubstance substance = action.getSubstance();
    where the id is null. That’s fine.

    Then I persisted an equivalent Server Side object. From this new object, I get an id.
    I update the bean with this id:
    substance.setId(id);
    and send the response with the same updated bean :
    return new StoreSubstanceResponse(substance);

    But the bean is not updated on the client side. The id is still null !

    Did I missed something ?

    Thanks in advance

    Pierre

    #349603 Reply

    support-swapna
    Moderator

    Pierre,

    While its hard to pinpoint what is missing without seeing the project, I suggest you look at sample examples for GWT+Spring and understand the flow better. Please also check on development related forums like stackoverflow.com for better inputs from the developer community.

    Here are some links for GWT+Spring examples :

    http://www.javacodegeeks.com/2010/05/gwt-2-spring-3-jpa-2-hibernate-35-2.html
    http://stackoverflow.com/questions/16423116/gwt-2-5-spring-3-hibernate-3-clear-example

    Hope it helps.

    #349619 Reply

    totoheros
    Member

    Hi,

    Thanks for the urls but it didnot help.

    As for now iI am doing a pure gwt prototype, there is no Spring no jta …

    I want to get rid of all id on the user interface as they are going to be taken care of on the persistence layer.

    But a new object with id=null breaks the pure CRUD generated.

    I will apprecied any hint how to modify the web generated source (gwt 2.0) for achive the scenario described in my previous post :

    1) creation of new object without id on client side
    2) on server side, get the id from the db (or whatever persistence mecanism) and send back to client
    3) take the new id into accout on client side

    Thank in advance

    Pierrre

    #349633 Reply

    totoheros
    Member

    I made an attempt to manage the id’s on server side. It’s woks but I am not sure it’s the best way to do that.

    Let say I create a Substance. I have modified the SubstanceTable class generated:

    1) In method addSubstance(GWTSubstance substance), i added

    substance.setId(ID_NEW_SUBSTANCE);
    so that an id is set with an unique value.

    2) in method updateSubstance(GWTSubstance substance)
    substance has now the real id set on server side.
    Of course the stored substance can not be found with this real id so I changed this method with :

    GWTSubstance stored = tableModel.getSubstanceById(new GWTSubstanceID(substance));

    if (stored == null) {
    // find new created substance with id = ID_NEW_SUBSTANCE
    Collection<GWTSubstance> allSubtancesStored = tableModel.getAllsubstances();
    for (GWTSubstance storedSubstance : allSubtancesStored)
    {
    if (storedSubstance.getId() == ID_NEW_SUBSTANCE)
    {
    stored = storedSubstance;
    break;
    }
    }

    if (stored != null)
    stored.setId(substance.getId()); // change with real id
    else
    return;
    }

    What do you think, is that fine ? Do I have to do additionnal things ?

    Thanks in advance

    Pierre

    #349638 Reply

    support-swapna
    Moderator

    Pierrre,

    I am afraid this is a pure development query and we will not be able to help you out with the development related issues. As I suggested earlier, its better to post to development related forums for better help from the developer community.

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Gwt Scaffolding for 2.0.4 problem. No details

You must be logged in to post in the forum log in