[jboss-user] [JBoss Seam] - Re: datasource testing

alex_enache do-not-reply at jboss.com
Wed Aug 29 03:08:07 EDT 2007


Sorry I submited it, instead of previewing it :D. I'll continue my question here.

And I have the following bean:
@Entity
  | @Name("user")
  | @Scope(SESSION)
  | @Table(name="test")
  | public class User implements Serializable {
  | 	private static final long serialVersionUID = 1881413500711441951L;
  |    
  | 	private int varsta;
  | 	private String prenume;
  | 	private String nume;
  | 	private int id;
  |    
  | 	public User(String newName, String newForname, int newAge, int newId) {
  | 		nume = newName;
  | 		prenume = newForname;
  | 		varsta = newAge;
  | 		id = newId;
  | 	}
  |    
  | 	public User() {
  | 		System.out.println("========USER CREATED==========");
  | 	}
  |    
  | 	@NotNull
  | 	public String getNume() {
  | 		return nume;
  | 	}
  | 
  | 	public void setNume(String newName) {
  | 		nume = newName;
  | 	}
  |    
  | 	@NotNull
  | 	public String getPrenume() {
  | 		return prenume;
  | 	}
  | 
  | 	public void setPrenume(String newForname) {
  | 		prenume = newForname;
  | 	}
  |    
  | 	@NotNull
  | 	public int getVarsta() {
  | 		return varsta;
  | 	}
  | 
  | 	public void setVarsta(int newAge) {
  | 		varsta = newAge;
  | 	}
  |    
  | 	@Id @NotNull
  | 	public int getId() {
  | 		return id;
  | 	}
  | 
  | 	public void setId(int newId) {
  | 		id = newId;
  | 	}
  |    
  | 	@Override
  | 	public String toString() {
  | 		return "User(" + nume + prenume + ")";
  | 	}
  | }

This was basicly took from seam's registering example and modified a bit.
My table is:
nume varchar(20)
prenume varchar(20)
id int not null auto_increment, primary key

And on a page I have a very basic controller:
<h:outputText value="User name=#{user.nume}"/>

All this is enough in order for the bean to retrieve the info from the DB ?? cuz it doens't work :(.

Best regards,
Alex Enache

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079016#4079016

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079016



More information about the jboss-user mailing list