[JBoss Seam] - seam-gen is not a solution worth trying for existing EJB3 pr
by mortena
Hi Seam folks
I've tried getting a proper start using seam by using seam-gen. The basis of the project is a running EJB3 application with a JSP based web-interface.
Based on a number of searches on the web I concluded that seam-gen should be able to generate the CRUD based WEB-UI in seconds based on the existing EJB3 application.
It is not! And I recommend none to use that tool!
seam-gen reverse engineers directly from the database not the EJB3's already created and it does it in a rather dumb manner! ?
All the information regarding the relationships (OneToOne, ManyToOne and ManyToMany) between the entities are totally lost when the view is generated from database instead of directly from the EJB's.
The reason for this is probably that it was possible to use hibernate Tools as a basis for seam-gen and that the developers needed something up and running fast...
Why is there not a tool in the seam-gen pack, that makes it possible to generate a CRUD view with proper support for dates, relationsships etc. directly from EJB3 entities?
This would make it possible to create the entities, set the relationships between them and have a seam-application up and running based on that in no time.
Instead we're stuck with a tool that does some of the basic stuff in a seam-application like inserting strings into entities using a textinput but not the stuff like creating a drop-down with objects to select the "One" side in a ManyToOne relationsship.
Please comment on the following:
- How can I go from an existing EJB3 application with a JSP based ui to a seam application?
- How can I support refactoring in such an application?
- How can I support an iterative implementation in such an environment?
- What are the plans with seam-gen?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103407#4103407
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103407
18 years, 8 months
[JBoss Tools (users)] - Re: JBoss Tools Documentation
by max.andersen@jboss.com
"bdlink" wrote : I guess what I would find useful (after trying generate-entries on an earlier test project) would be something that either maps entities to tables, or generates tables from entities, but since in either case, the mapping probably needs some ability for human guidance.
Yes - we never claimed anything else ;)
anonymous wrote : For example, given a schema, a tool can not guess whether I want to navigate both directions, may not be able to guess if a relation is 1-1 or 1-n (at least generate entities turned my 1-1 relationships to 1-n, even though I had put unique constraints on the table to force only one interpretation).
Hibernate Tools by default generates a one-to-many and a many-to-one per foreign key.
All this is controllable by a reveng.xml and/or a custom programmatic reverse engineering strategy - read up on that in Hibernate Tools documentation (see http://tools.hibernate.org)
anonymous wrote :
| Another example which could not be guessed from the schema is if I want the entities to be in an inheritance relationship.
Yes - and I don't believe it should. If you start doing inheritance and more complex mappings you are basically going to write what corresponds the mapping files/annotations and then reverse engineering is not really usefull.
anonymous wrote :
| My main issue with generate entities is not that it guesses wrong, but that after hand-fixing the entities, the other artifacts need massive editing, and it is hard to be sure I have found everything. If I restart the project (to perhaps use a new version of the tools or seam) I have to go through the entire process again.
|
so just use Hibernate Tools codegeneration to just generate one set of the artifacts; e.g. the entities. Seam Generate Entitites is just a wizard that configures a Hibernate Tools codegeneration launch to generate a full app. You can tweak that codegeneration launch as much as you like. Goto Run > Hibernate Code Generation > Open Hibernate Code generation dialog (or use the toolbar shortcut) to get access to the "tweaking" (you can copy the config if you want to customize it/keep it around so Seam Generate Entitites won't override it next time you try it for the same project)
anonymous wrote :
| As well, the CRUD pages generate-entities creates are interesting from the standpoint of a demo, and for seeing how they are done, however, I am not convinced I would want these pages for creating and updating generated for each table
We are planning to add more selective generation for the artifacts/tables.
anonymous wrote :
| (For example, that is not how to handle an associative table that implements a many-many relationship).
Yes - the seam-gen templates that we use does not support many-to-many yet (feel free to contribute ;)
anonymous wrote :
| So generate-entities seems to create a lot of things that have to be edited/deleted. (apropos names, it generates a lot more than entities)
|
Again, if you think some of the *automatic* code generation can be generally improved or something is generated wrong then please report it in jira.
anonymous wrote :
| I may be wrong in the above feelings, but in any case, generating EJB3 entities/session beans is a useful separate thing from getting everything seam generate entities creates.
|
Yes - so use hibernate tools generation to select what you want; this is a 2 year old featureset - its only Seam Generate Entities that is "new" ;)
(The "single table" entity generation is not there yet, but will be added in upcoming releases)
anonymous wrote : Is there a place that the use cases for RHDS are described?
We have the documentation for the various plugins and some new docs in the pipeline (see above for the hibernate tools part)
The closest we get to a documented dev usecase set for the seam features is at http://anonsvn.jboss.org/repos/jbosstools/trunk/documentation/development...
But these were just for the new Seam related parts.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103406#4103406
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103406
18 years, 8 months
[JBoss Seam] - SFSB session scope with Factory method conversation scope: h
by asookazian
sorry, this is a long one...
I have a use case which may require two SFSB's for a facelet. The facelet has a h:dataTable and a rich:modalPanel (which has a4j:form embedded in it). The main SFSB for the dataTable's form was conversation scoped. I am using the @Factory and @DataModel tag team annotations to outject the DataModel List for the dataTable in the facelet.
The second SFSB which handles form submissions from a rich:modalPanel was session scoped b/c the popup form submissions are not immediately persisted to the DB tables. I was injecting the second SFSB into the main SFSB (which I'm not sure is a good idea or not with Seam apps).
So I decided to refactor this implementation and move all the logic/methods/variables from the second SFSB into the main SFSB (idea being to have one SFSB per facelet).
I've tried different combinations of configurations with the @Factory annotation and have found the following (as is basically explained on pg. 68 of the Seam reference pdf for 2.0.0.GA):
Since now there is only one SFSB and it is session scoped (to keep track of the modalPanel submitted form data until the main form is submitted), I needed a conversation or request scoped Factory method. Otherwise, the factory method will only be called once per session. There are multiple submit buttons (one per row) on the main form. So when user submits a row for persistence, the Factory method needs to fire again before dataTable is re-rendered so that the data is current.
So I tried the first style as below:
@Factory(value="customerList",scope=ScopeType.CONVERSATION)
| public List<Customer> getCustomerList() {
| return ... ;
| }
The problem with this solution is that I get
java.lang.NumberFormatException: For input string: "rowCount"
when I check for the List's rowCount in the facelet as below:
<h:dataTable value="#{customerList}" rendered="#{customerList != null and customerList.rowCount > 0}">
Also, method not found for #{customerList.getRowIndex()}
I think the reason I'm having these problems is b/c the @DataModel is not being used and therefore no outjection of a DataModel object that the JSF can use to render the dataTable (i.e. a regular List does not have a rowCount property or getRowIndex() method). I'm not sure I can even use a DataModel with this first style.
So I try the second style as follows:
@DataModel List<Customer> customerList;
|
| @Factory("customerList")
| public void initCustomerList() {
| customerList = ... ;
| }
The problem with this solution is that b/c the @Factory annotation can't have a conversation scope when the method returns void, the initCustomerList() method will only get executed once per session (and I need it to exec per request/conversation).
So what am I doing wrong and/or how can I solve this use case with a single facelet, a single SFSB, and ...??? I think I tried PAGE scope with @DataModel and it didn't help or work. From the Bauer talk it sounds like PAGE context is useful with Ajaxified Seam apps.
I looked at the @Unwrap and manager component pattern as well but that forces the annotated method to be called every time the context variable is referenced (I'm assuming in the facelet???) So not sure if that's appropriate or not.
Sounds like if I can get rowCount of the List and getRowIndex() equivalent for the List, I might be ok EXCEPT for I lose out on the @DataModelSelection and @DataModelSelectionIndex for processing a clicked row in the dataTable (which in this case, the query is based on two tables/entities).
Basically: how can I get this to work for my use case with @Factory and the @DataModel* anntotations with one facelet and one SFSB???
Please help, I'm frustrated and confused... thx.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103404#4103404
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103404
18 years, 8 months