-
1. Re: Create New Entity -> Page Round Trip & Update autoincrem
griffitm Oct 8, 2007 7:01 PM (in response to griffitm)It seems as if persisting the entity is not tied to the correct instance?
My page navigation all look as follows:<param name="statusFrom"/> <param name="statusId" value="#{statusHome.statusId}"/>
The value that is tied to the HTML for, (therefor the value that I would believe to be forwarded as a parameter after the persist method is:<h:inputText id="id" required="true" disabled="#{statusHome.managed}" value="#{statusHome.instance.id}"> <a:support event="onblur" reRender="idDecoration" bypassUpdates="true"/> </h:inputText>
Am I on the wrong track here?
Thanks in advance for any suggestions!
MG -
2. Re: Create New Entity -> Page Round Trip & Update autoincrem
saeediqbal1 Oct 9, 2007 12:18 AM (in response to griffitm)I am not good at this either, but i see at one point you call it statusId and the other one you just call it id , is this a typo?
-
3. Re: Create New Entity -> Page Round Trip & Update autoincrem
griffitm Oct 9, 2007 9:04 AM (in response to griffitm)These are seamgen generated variable and class names, based on the tables that are backed by the EJB3 entity beans. If the names of the variables are wrong, its because they were generated incorrectly. I don't think that is the case. Can someone point me to a request/response cycle for SEAM? The seam reference guide states:
You can define actions and parameters for
a page with the view id /calc/calculator.jsp in a resource named calc/calculator.page.xml. The root
element in this case is the <page> element, and the view id is implied:
Is there some sort of impedance between what the convention is and what seamgen generates?
Thanks in advance. -
4. Re: Create New Entity -> Page Round Trip & Update autoincrem
griffitm Oct 9, 2007 11:50 AM (in response to griffitm)In the struts world, I've dealt with this by getting the ID after update and explicitly updating my model with the id after the DB update. This is usually done in the struts action class.
Is there a similar metaphor for doing this in seam? Do I need to have a stateless session bean that updates something? I am not quite sure how this would map back to my model or page parameter. I can't believe this is a difficult problem, only one where I do not know where the answer lives.
Anyone have the same problem and overcome it? Any help would be much appreciated!
MG -
5. Re: Create New Entity -> Page Round Trip & Update autoincrem
griffitm Oct 9, 2007 2:56 PM (in response to griffitm)Since I seem to be having this conversation with myself, I thought I'd post the solution so I would know what I did wrong. When I used seamgen to generate the entities
seam generate-entities
It did not properly add the @GeneratedValue annotation to the entity class for the autoincrement field in the table. I'm not sure if this is a hibernate defect, seamgen defect or user error --but it sure was looking for a needle in a haystack.