Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
29. Apr 2008, 21:07 CET | Link

Seam - 2.0.1GA JBoss - 4.2.2

<a4j:commandButton id="save" value="Save"
	action   = "#{fundPerformanceHome.persist}"	               
	rendered = "#{!fundPerformanceHome.managed}"
	reRender = "addFofPerf"/>
	....
	....
	....
<a4j:outputPanel id="addFofPerf">
	<s:decorate template="WEB-INF/view/templates/decorateField.xhtml">	
	<ui:define name="label">Fund Name</ui:define>
	<h:selectOneMenu value="#{fundPerformance.fund}">
		<s:selectItems value="#{fundsQuery.resultList}" var="fund" label="#{fund.name}" noSelectionLabel="Please select" />
	   <s:convertEntity />
	</h:selectOneMenu>
	</s:decorate>
	<s:decorate template="WEB-INF/view/templates/decorateField.xhtml">                 
		<ui:define name="label">Initial Investment Date:</ui:define>
		<rich:calendar id="date" datePattern="MMM/yyyy"
			value="#{fundPerformance.initialInvestmentDate}"/>
	</s:decorate>
	<s:decorate template="WEB-INF/view/templates/decorateField.xhtml">                 
		<ui:define name="label">Time Period:</ui:define>
		<rich:calendar id="date" datePattern="MMM/yyyy"
			value="#{fundPerformance.timePeriod}"/>
	</s:decorate>
	....
	....
	.... other entity properties ...
<a4j:outputPanel

Sample contents from components.xml,


<framework:entity-query name="fundsQuery" ejbql="select f from Fund f" />
<framework:entity-home name="fundPerformanceHome" entity-class="xxx.entity.FundPerformance" />
<factory name="fundPerformance" value="#{fundPerformanceHome.instance}" scope="event"/>
...
...

I'm able to save an instance of FundPerformance but it's an empty row in the database. The only two fields populated are createdBy and createdDate which is a @PrePersist annotation in my entity class

What am I missing?

within the same environment setup, I'm able to invoke a SFSB seam component, action handler as well EJBQuery methods.

4 Replies:
03. May 2008, 23:56 CET | Link

The initial problem was solved by wrapping the

<h:form>

tag at the right place (it was displaced before). However, EntityHome now persists always with s primary key beginning with 1, irrespective of whether there is data present or not. I double checked the sequence (I have same sequence number for all the tables) using


SELECT hibernate_sequence.NEXTVAL FROM dual;

,

the value was 21.

I'm generating the schema completely with hbm.ddl.auto and the default sequence generator is same for all the tables ( no max limit)

Any suggestions?

PS: If there is no data, it does work though.(with pk 1,2,3 etc ..)

04. May 2008, 06:31 CET | Link

Can you post the annotations you are using on the primary key field?

Cheers,

Andy Gibson

 

It's a job that's never started that takes the longest to finish. - J.R.R. Tolkien

---------- www.andygibson.net ----------

04. May 2008, 08:20 CET | Link

I dont have the code handy rt now, but it's something like this:-

@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
private long id;

all our entity classes extend a BaseEntity class which has a version, id and some audit columns.

I've used similar annotations before, but using hibernate annotations. Didn't have a problem them. I'm guessing that running scripts (import.sql in classpath) via hbm.ddl.auto won't increment the sequence correctly.

05. May 2008, 18:08 CET | Link

I have tried with GenerationType.AUTO as well and I manually updated the sequence number in the database too, the problem persists -- it always saves with pk 1, to begin with.

Any help, appreciated.