| 
					
						 Hi Alan,
 sure, I commit it.
 here is my code.
 
 my table is
 CREATE TABLE `t_conferences` (   `confuri`      varchar(255) NOT NULL,   `conf_state`   varchar(255),   `mrf_sip_uri`  varchar(255),   `confID`       varchar(255),   `user_count`   int,   /* Keys */   PRIMARY KEY (`confuri`) ) ENGINE = MyISAM;
 
 hibernate.cfg.xml is
 <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC   "-//Hibernate/Hibernate Configuration DTD 3.0//EN"   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
  <hibernate-configuration>   <session-factory>     <!-- Database connection settings -->     <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://x.y.z.j:3306/maurodb</property>     <property name="connection.username">root</property>     <property name="connection.password">root</property>     <property name="connection.pool_size">1</property>     <property name="dialect">org.hibernate.dialect.MySQLDialect</property>     <property name="current_session_context_class">thread</property>     <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>     <property name="show_sql">true</property>     <property name="hbm2ddl.auto">create</property>     <mapping resource="provaHibernate/Conference.hbm.xml"/> </session-factory> </hibernate-configuration>
 
 Conference.hbm.xml
 
 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  <hibernate-mapping>   <class name="provaHibernate.Conference" table="t_conferences">   <id name="confURI">   </id>     <property name="conf_state"/>     <property name="mrf_sip_uri"/>     <property name="confID"/>     <property name="user_count"/>   </class> </hibernate-mapping>
 
 Conference Java class is
 public class Conference { 	private String confURI = new String(); 	private String conf_state = new String(); 	private String mrf_sip_uri = new String();  	private String confID = new String(); 	private int user_count; 	 	public Conference(String confURI) { 		this.confURI = confURI;     	this.conf_state = "creating"; 	    this.user_count = 1; 	} 	public Conference() { 	}
  	public String getConfURI() { 		return confURI; 	}
  	public void setConfURI(String confURI) { 		this.confURI = confURI; 	}
  	public String getConf_state() { 		return conf_state; 	}
  	public void setConf_state(String conf_state) { 		this.conf_state = conf_state; 	}
  	public String getMrf_sip_uri() { 		return mrf_sip_uri; 	}
  	public void setMrf_sip_uri(String mrf_sip_uri) { 		this.mrf_sip_uri = mrf_sip_uri; 	}
  	public String getConfID() { 		return confID; 	}
  	public void setConfID(String confID) { 		this.confID = confID; 	}
  	public int getUser_count() { 		return user_count; 	}
  	public void setUser_count(int user_count) { 		this.user_count = user_count; 	} 	 }
 
 and main is
 System.out.println("Conference Unit Test"); 		 		Session session=new Configuration().configure().buildSessionFactory().openSession(); 		 		 //Creo una nuova conference 	    Conference conf=new Conference(); 		conf.setConfURI("conf5"); 	    conf.setConf_state("creating"); 	    conf.setMrf_sip_uri("mrf2"); 	    conf.setConfID("id1"); 	    conf.setUser_count(2); 	     	    //Utilizziamo un modello transazionale dichiarativo 	    session.beginTransaction(); 	     	    //Chiedo al middleware di cancellare questo oggetto nel database 	    //session.delete(conf); 	    //Chiedo al middleware di salvare questo oggetto nel database 	    session.save(conf); 	     	    //fine della transazione: salviamo tramite commit() 	    session.getTransaction().commit(); 		 	    System.out.println("Done");
 
 Please, I hope that you can help me.
 
 Mauro
 [/b] 
					
  
						
					 |