Hello All,

I am new in this list and I have a little "beginner" problem:
I have one table called "Clientes" in a MySQL database and using the hibernate 
framework I can not save a new object at this table.

No error is reported but the object is not insert in the table.

Bellow is the content of the Cliente.hbm.xml file, Cliente.java and the Test.java.

Please help me.

Best Regards,
Miguel.

This is the Cliente.hbm.xml file:
---------------------------------------------
<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd";>

<hibernate-mapping>
  <class name="Cliente" table="Clientes">
    <id name="oid" column="oid" type="long">
      <generator class="assigned"/>
    </id>

    <property name="marca" />
    <property name="razaoSocial" />

  </class>


</hibernate-mapping>
================================================================


This is the content of Cliente.java:
-------------------------------------------------
public class Cliente {

    public Long getOid() {
        return oid;
    }

    public void setOid(Long oid) {
        this.oid = oid;
    }

    public String getMarca() {
        return marca;
    }

    public void setMarca(String marca) {
        this.marca = marca;
    }

    public String getRazaoSocial() {
        return razaoSocial;
    }

    public void setRazaoSocial(String razaoSocial) {
        this.razaoSocial = razaoSocial;
    }

    private Long oid;
    private String marca;
    private String razaoSocial;

}

================================================================

And this is the content of Test.java:

import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.Session;

public class Test {

    Test() throws Exception {
        Configuration cnf=new Configuration();
        cnf.addClass(Cliente.class);

        Cliente cli = new Cliente();
        cli.setMarca("BLA BLA BLA");
        cli.setRazaoSocial("BLA BLA BLA");
        SessionFactory sf=cnf.buildSessionFactory();
        Session ss=sf.openSession();

        ss.save(cli, new Long(1));
    }


    public static void main(String[] args) throws Exception {
        new Test();
    }
}


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to