2 Replies Latest reply on Dec 26, 2005 7:54 PM by gavin.king

    Reverse engineered code

    lavoir

      I been dealing with a few eclipse errors during reverse engineering, but its been fun looking at the tool work.

      I assume only One to many relationships are supported. I had the following tables:
      user, user_role, role

      My User entity ended up using UserRole as a One to Many as did my Role entity.

      I m a was a little confused when I sa the *Selector files. Static EJB classes in interfaces? Anywhere I can read up on that?

      I can definatetly see using this tool to get prototypes of the ground quickly, in fact, Id be quite curious to time how long it took me to create a tada list experiment.

      - why was JSP chosen over facelets?

      I couldnt help notice the generate DAO option on the generation tool, wouldnt it be nice that if you selected seam and DAO option, that is what you would get? :)

      I m really liking working with Seam so far. luckily, I got a week vacation coming up :)

        • 1. Re: Reverse engineered code
          lavoir

          I still havent encountered this type of Interface before, here is an example of the generated code I am wondering about. I ll be dusting of some books and reviewing the interface sections I guess.


          package com.xxx;
          // Generated 22-Dec-2005 7:47:50 PM by Hibernate Tools 3.1.0 beta1JBIDERC2
          
          import java.util.ResourceBundle;
          import javax.ejb.Interceptor;
          import javax.ejb.Local;
          import javax.ejb.Stateless;
          import org.jboss.seam.annotations.Begin;
          import org.jboss.seam.annotations.In;
          import org.jboss.seam.annotations.Name;
          import org.jboss.seam.ejb.SeamInterceptor;
          
          
          
          @Local
          public interface CommentSelector {
          
           public String select();
           public String selectNone();
          
           public String getButtonLabel();
           public String getPageTitle();
          
           public String cancel();
          
           public boolean isCreateEnabled();
          
           @Stateless
           @Name("CommentSelector")
           @Interceptor(SeamInterceptor.class)
           public static class DefaultCommentSelector implements CommentSelector {
          
           @In
           private ResourceBundle resourceBundle;
          
           @In(create=true)
           private CommentEditor CommentEditor;
          
           @In(create=true)
           private CommentFinder CommentFinder;
          
           @Begin
           public String select() {
           CommentEditor.setInstance( CommentFinder.getSelection() );
           CommentEditor.setNew(false);
           return "edit";
           }
          
           public String selectNone() {
           throw new UnsupportedOperationException();
           }
          
           public String getButtonLabel() {
           return resourceBundle.getString("View");
           }
          
           public String cancel() {
           throw new UnsupportedOperationException();
           }
          
           public String getCommentTitle() {
           return resourceBundle.getString("Find") + " " +
           resourceBundle.getString("Comment");
           }
          
           public boolean isCreateEnabled() {
           return true;
           }
          
           }
          
          }
          


          • 2. Re: Reverse engineered code
            gavin.king

             

            "lavoir" wrote:
            I been dealing with a few eclipse errors during reverse engineering, but its been fun looking at the tool work.


            What errors occured? Please report bugs to Hibernate Tools JIRA.

            "lavoir" wrote:
            I assume only One to many relationships are supported.


            Right.

            (I never use many-to-many anyway, sometimes i think it's an abomination.)


            "lavoir" wrote:
            I m a was a little confused when I sa the *Selector files. Static EJB classes in interfaces? Anywhere I can read up on that?


            I am trying to implement a bit of polymorphism, so that I can use the same functionality in the "search for X" pages as in all the "select X for Y" pages. (JSF does not make this kind of thing extremely easy to do.)

            Basically this is just a strategy pattern. Pretend the inner classes are just toplevel classes, I'm only generating them into the same file because I couldn't figure out how to generate a file for each association in the reverse engineering templates. I have to ask Max about that.


            I can definatetly see using this tool to get prototypes of the ground quickly, in fact, Id be quite curious to time how long it took me to create a tada list experiment.

            "lavoir" wrote:
            why was JSP chosen over facelets?


            No good reason. I need to make this settable.

            "lavoir" wrote:
            I couldnt help notice the generate DAO option on the generation tool, wouldnt it be nice that if you selected seam and DAO option, that is what you would get? :)


            I dunno, I'm coming to the conclusion that the DAO pattern is just overkill for these kinds of crud applications. EntityManager _is_ a DAO ;-)