Solved

SEAM-GEN Entities and the issue of BOOLEAN type fields

Posted on 2009-03-30
1
523 Views
Last Modified: 2013-12-02
Hello Everyone,

I'm experiencing a strange issue with Seam-Gen after generating the Seam entities from a database with 3 tables (using JBoss Developer Studio ver: 2.0.0.CR2). Any entity/table with BOOLEAN type field throws validation errors (length must be between 0 and 1) no matter what AND even if I comment out that input boolean field (from front end) just to test that I can save it. I get this error from the console: 21:19:01,489 ERROR ContainerBase Servlet.service() for servlet Faces Servlet threw exception. The only time I do not have any issues with saving via the Seam generated CRUD form is if it is saving to a table that does not have any BOOLEAN fields?

I SEAM-GEN'ed from a postgresql database v8.4, has anyone else encountered these issues? If so did you find a solution? Or do I have to make sure that when I design my database(s) that I don't use boolean type columns?

Example javabean found in code section below which is mapped to the database

Thanks,
package com.jsfcompref.virtualtrainerseam.entity;
 
// Generated Mar 26, 2009 12:04:39 AM by Hibernate Tools 3.2.4.CR1
 
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
 
/**
 * Users generated by hbm2java
 */
@Entity
@Table(name = "users", schema = "public")
public class Users implements java.io.Serializable {
 
	private int accountno;
	private String firstname;
	private String lastname;
	private String gender;
	private Date dob;
	private String email;
	private String servicelevel;
	private String userid;
	private String password;
	private Boolean trainer;
	private Boolean isloggedin;
 
	public Users() {
	}
 
	public Users(int accountno) {
		this.accountno = accountno;
	}
 
	public Users(int accountno, String firstname, String lastname,
			String gender, Date dob, String email, String servicelevel,
			String userid, String password, Boolean trainer, Boolean isloggedin) {
		this.accountno = accountno;
		this.firstname = firstname;
		this.lastname = lastname;
		this.gender = gender;
		this.dob = dob;
		this.email = email;
		this.servicelevel = servicelevel;
		this.userid = userid;
		this.password = password;
		this.trainer = trainer;
		this.isloggedin = isloggedin;
	}
 
	@Id
	@Column(name = "accountno", unique = true, nullable = false)
	@NotNull
	public int getAccountno() {
		return this.accountno;
	}
 
	public void setAccountno(int accountno) {
		this.accountno = accountno;
	}
 
	@Column(name = "firstname", length = 400)
	@Length(max = 400)
	public String getFirstname() {
		return this.firstname;
	}
 
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
 
	@Column(name = "lastname", length = 400)
	@Length(max = 400)
	public String getLastname() {
		return this.lastname;
	}
 
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
 
	@Column(name = "gender", length = 400)
	@Length(max = 400)
	public String getGender() {
		return this.gender;
	}
 
	public void setGender(String gender) {
		this.gender = gender;
	}
 
	@Temporal(TemporalType.DATE)
	@Column(name = "dob", length = 13)
	public Date getDob() {
		return this.dob;
	}
 
	public void setDob(Date dob) {
		this.dob = dob;
	}
 
	@Column(name = "email", length = 400)
	@Length(max = 400)
	public String getEmail() {
		return this.email;
	}
 
	public void setEmail(String email) {
		this.email = email;
	}
 
	@Column(name = "servicelevel", length = 400)
	@Length(max = 400)
	public String getServicelevel() {
		return this.servicelevel;
	}
 
	public void setServicelevel(String servicelevel) {
		this.servicelevel = servicelevel;
	}
 
	@Column(name = "userid", length = 400)
	@Length(max = 400)
	public String getUserid() {
		return this.userid;
	}
 
	public void setUserid(String userid) {
		this.userid = userid;
	}
 
	@Column(name = "password", length = 400)
	@Length(max = 400)
	public String getPassword() {
		return this.password;
	}
 
	public void setPassword(String password) {
		this.password = password;
	}
 
	@Column(name = "trainer")
//	@Length(min = 1, max = 1)
	public Boolean getTrainer() {
		return this.trainer;
	}
 
	public void setTrainer(Boolean trainer) {
		this.trainer = trainer;
	}
 
	@Column(name = "isloggedin", length = 1)	
//	@Length(min = 1, max = 1)
	public Boolean getIsloggedin() {
		return this.isloggedin;
	}
 
	public void setIsloggedin(Boolean isloggedin) {
		this.isloggedin = isloggedin;
	}
 
}

Open in new window

0
Comment
Question by:NMATRIX9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
NMATRIX9 earned 0 total points
ID: 24104232
Issue solved it was the database schema itself with character length set too short.
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse console opening separately 2 48
ejb mdb examples 1 38
American Express @Work site and Java 4 93
listing all the respondents to a twitter feed - Java 5 45
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question