4 Replies Latest reply on Jun 6, 2007 4:59 PM by delphi'sghost

    seam-gen: What is it good for?

    mugwump

      After playing a while with seam-gen, I'd really like to hear if somebody is actually using this for something more than generating a template from which to start. I mean, is this supposed to be something comparable to rails or grails scaffolding? Or is it just a toy to give you a prepared build and some wired components?

      For serious work, all this seems to be too fragile. Here is what happened after 2 hours of work:

      action-package screwed up:
      although both

      model.package=<mypackage>.model
      action.package=<mypackage>.action
      


      are setup in build.properties, all files get generated into the package model.package=.model with no apparent reason.

      netbeans project does not compile out-of-the-box:netbeans-project is setup with action..action and model..model as src-folders. Takes a while to realize, that these are two distinct source-folders and you have to manually set them up.

      Clean task is working mediocre: There is a task missing to clean up the exploded directory: if you happen to move a class between packages, you end up with duplicate components (and undeploy does not work when the server is running).

      The database is torn down, when the server is shuts down, which is fatal, if you you go bottom-up and use your database and generate-entities for modelling, which seam-gen suggests.

      Entities with relations throw a "duplicate method: createInstance"-Exception, which I did not manage to resolve.

      Taken all this rather unpleasant experience together, I think we still have a long way to go to have something comparable to the simple rails script/generate scaffold - which simply works.

      I'm pretty sure, that this whole code-generation stuff can be turned into something really really powerful (with the mix of hbm2xml&freemarkertemplattes you can sure do a good thing or two...). Right now, I just wonder, what the audience for this is?! It only has basic features, so it's not suitable for real projects (what about schema-evolution, mechanisms for extending classes, top-down generation, per-project properties, using uml-models as basis etc.) - given the fact that it is terribly easy to break and terribly hard to get it running for more than the most basic tasks, it's not for the novice either - so again, the question: Where is seam-gen heading?!





        • 1. Re: seam-gen: What is it good for?
          thejavafreak

          Then go and contribute to improve seam-gen. I think it's far better than just rattling like this.

          • 2. Re: seam-gen: What is it good for?

            Even though I don't rely on seam-gen, I do use it some times to see how to enable certain services/features of Seam through through the generated configuration as they already lay out the ground work for a working Seam application. As well, the generated code could give you some ideas and/or general guidelines as to how Seam applications should be built. I think it's a useful tool for helping newbies getting quickly off the ground without having to fuss around with configuration. Take it for what it is.

            • 3. Re: seam-gen: What is it good for?
              awhitford

              I think you have raised a good question...

              I personally don't use it beyond getting an initial baseline. I have found that even after the code generation, I need to hunt around and make several tweaks (disabling schema validation, changing the naming strategy -- some of this is related to Oracle). Also, if you augment the an Entity bean, and then run generate-entities again, you will lose your change. As a result, I don't feel it is meant to be used throughout the development cycle...

              Of course, I think it should be easier to run it repeatedly. I have asked for a way to say, "generate-entities <table_name>", so that you could just add the one entity and CRUD.

              I also think you should be able to supply your own Entity bean, and just let seam-gen create the CRUD. This would skip the reverse engineering -- there are several issues that I have with the reverse engineering (lack of enum support, constraints, etc.).

              I am also a Maven fan, so I will take the ant oriented project and migrate it to a maven oriented project... I could see seam-gen evolve into a maven plugin. Imagine:

              c:\workspace\project\> mvn seam-gen:generate-crud <entity_class_name>



              • 4. Re: seam-gen: What is it good for?
                delphi'sghost

                I use it to create an empty application shell as a starting point.

                I tend not to use the CRUD stuff, since as I recall, it uses the Seam Framework (entity home & Co) for that.

                Call me a masochist, but I'm still working out how to do entity Crud, with RESTful edit pages on my own (I'm almost there!).