This content has been marked as final.
Show 5 replies
-
1. Re: Easy question : Problem submitting form with double value.
binnyg Feb 13, 2009 2:23 AM (in response to valatharv)Try this
<h:inputText value="#{itreat.treatmentConcentration}" required="true"> <f:converter id="javax.faces.Double"/> </h:inputText>
You can Hibernate validator with your entities.
-
2. Re: Easy question : Problem submitting form with double value.
valatharv Feb 13, 2009 4:11 PM (in response to valatharv)I tried as suggested, issue is same "When I fill this field as varchar or leave it null. On Clicking "Save" (it calls persist) nothing happens, page is not submitted and
I can't even see the SOP as given in xxxxHome.persist()."
I checked "persistence-dev.xml" "hibernate.hbm2ddl.auto" entry was missing, so I added this "<property name="hibernate.hbm2ddl.auto" value="validate"/>" to persistence-dev.xml
Now, when I restart Jboss, I am getting this error..
-------------------------
[ServiceController] Problem starting service persistence.units:ear=appSeam.ear,jar=appSeam.jar,unitName=appSeam
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: TREATMENTCONCENTRATION, expected: double precision
-------------------------
I am missing some basic settings.
This is entity.
@Entity(name = "Treatment")
public class Treatment implements Equals, HashCode, ToString {
protected double treatmentConcentration;
@Basic
@Column(name = "TREATMENTCONCENTRATION")
public double getTreatmentConcentration() {
return treatmentConcentration;
}
} -
3. Re: Easy question : Problem submitting form with double value.
binnyg Feb 13, 2009 5:38 PM (in response to valatharv)If you are using hibernate then you should leverage hibernate validator.
@Entity(name = "Treatment") public class Treatment implements Equals, HashCode, ToString { protected double treatmentConcentration; @NotNull @Column(name = "TREATMENTCONCENTRATION", nullable = false) public double getTreatmentConcentration() { return treatmentConcentration; } }
In xhtml wrap your form fields with s:validate.
<s:validate> <input type="text" value="#{itreat.treatmentConcentration}"/> </s:validate>
Also, add h:messages to see the error message.
-
4. Re: Easy question : Problem submitting form with double value.
valatharv Feb 13, 2009 8:34 PM (in response to valatharv)<s:validate>
<h:inputText value="#{itreat.treatmentConcentration}" requiredMessage="Please enter as number">
</h:inputText>
</s:validate>
Gives exception on page loadd itself as :
Caused by: com.sun.facelets.tag.TagException: /xxxxEdit.xhtml @324,37 <s:validate> Parent not an instance of EditableValueHolder: com.sun.facelets.component.UIRepeat@1e7e7e8 -
5. Re: Easy question : Problem submitting form with double value.
binnyg Feb 13, 2009 11:45 PM (in response to valatharv)I can help you better if I can see your xhtml file.