2 Replies Latest reply on Aug 29, 2007 3:09 AM by Alexandru Enache

    datasource testing

    Alexandru Enache Newbie


      I have a small question. I've configured SEAM to use MySQL. And I want to do some small testing with it.



       <persistence-unit name="myTestDB">
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       <property name="hibernate.hbm2ddl.auto" value="none"/>

        • 1. Re: datasource testing
          Alexandru Enache Newbie

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

          And I have the following bean:

          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==========");
           public String getNume() {
           return nume;
           public void setNume(String newName) {
           nume = newName;
           public String getPrenume() {
           return prenume;
           public void setPrenume(String newForname) {
           prenume = newForname;
           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;
           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

          • 2. Re: datasource testing
            Alexandru Enache Newbie

            the db also has a "varsta" field, of type int ... I've missed that.