[JBoss Seam] - Seam Registration Example - trouble with Hibernate Validator
by aggtecnologia
Hi all, I?m trying to learn Seam by following the tutorial. I followed installation instructions (http://labs.jboss.com/portal/jbossseam/gettingstarted) thoroughly and everything went on seamlessly (pun intended :-)).
Registration example is working OK, EXCEPT when data don?t pass Hibernate Validator validation. If I don?t misunderstand it is supposed to redisplay the original page. Instead of that I?m getting an ugly:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error calling action method of component with id _idJsp0:_idJsp4
javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
javax.faces.FacesException: Error calling action method of component with id _idJsp0:_idJsp4
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
javax.faces.component.UICommand.broadcast(UICommand.java:106)
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
Validators ARE exacuted but I guess somebody (¿Seam?) is not catching the exception and directing JSF to the previous page to show the error messages. Instead of that the exception is being sent back to the client (brrrr!!!)
I know there are more interesting examples but I would like to understand what am I doing wrong.
I´ve been googling the whole afternoon but nobody seems to have noticed such behavior. Any clues will be VERY wellcome. Thanks in advance,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021847#4021847
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021847
19Â years, 2Â months
[JBoss Seam] - AnnotationException: no persistent id property
by cparham
Hi,
I've created two entity classes and a composite primary key class. I think I have all three coded properly but when I deploy with Seam 1.1.6 I get an exception:
AnnotationException: com.abc.selfEnrollment.RecordDataKey has no persistent id property
I'm sure I doing something silly. Please tell me what. Here are relevant sections from each class:
| @Entity
| @Name("record")
| @Scope(SESSION)
| @Table(name = "record")
| public class Record implements Serializable {
|
| private Long recordId;
| private Long agreementProductId;
| private Date createDate;
| private Date modifiedDate;
| private Date eventDate;
| private Long participantId;
| private Long recordStatusCode;
| private Long appUserId;
| private Collection<RecordData> recordData;
|
| public Record() {
| }
|
| @Id
| @GeneratedValue
| public Long getRecordId() {
| return recordId;
| }
|
| public void setRecordId(Long recordId) {
| this.recordId = recordId;
| }
|
| @OneToMany(cascade = CascadeType.ALL, mappedBy = "record")
| public Collection<RecordData> getRecordData() {
| return recordData;
| }
|
| public void setRecordData(Collection<RecordData> recordDatas) {
| this.recordData = recordDatas;
| }
| ...
| }
|
| @IdClass(com.abc.selfEnrollment.RecordDataKey.class)
| @Entity
| @Name("recordData")
| @Scope(SESSION)
| @Table(name = "record_data")
| public class RecordData implements Serializable {
|
| private Long recordId;
| private Long biomarkerId;
| private Record record;
| private Double value;
| private Long uomId;
|
| public RecordData() {
| }
|
| @Id
| public Long getBiomarkerId() {
| return biomarkerId;
| }
|
| public void setBiomarkerId(Long biomarkerId) {
| this.biomarkerId = biomarkerId;
| }
|
| @Id
| @Column(name = "ORDERID", nullable = false, insertable = false, updatable = false)
| public Long getRecordId() {
| return recordId;
| }
|
| public void setRecordId(Long recordId) {
| this.recordId = recordId;
| }
|
| @ManyToOne
| @JoinColumn(name = "RECORD_ID")
| public Record getRecord() {
| return record;
| }
|
| public void setRecord(Record record) {
| this.record = record;
| }
| ...
| }
|
| public final class RecordDataKey implements Serializable {
|
| public Long recordId;
| public Long biomarkerId;
|
| public RecordDataKey() {
| }
|
| public RecordDataKey(Long orderId, Long itemId) {
| this.recordId = orderId;
| this.biomarkerId = itemId;
| }
|
| public boolean equals(Object otherOb) {
| if (this == otherOb) {
| return true;
| }
| if (!(otherOb instanceof RecordDataKey)) {
| return false;
| }
| RecordDataKey other = (RecordDataKey) otherOb;
| return ((recordId == null ? other.recordId == null : recordId
| .equals(other.recordId)) && (biomarkerId == other.biomarkerId));
| }
|
| public int hashCode() {
| return ((recordId == null ? 0 : recordId.hashCode()) ^ ((int) biomarkerId
| .longValue() >>> 32));
| }
|
| public String toString() {
| return "" + recordId + "-" + biomarkerId;
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021833#4021833
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021833
19Â years, 2Â months