Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3
Mapping documents:<?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="store.Orders"
table="orders"
>
<id
name="orderId"
column="orderId"
type="long"
>
<generator class="native">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Orders.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="name"
type="java.lang.String"
update="true"
insert="true"
column="name"
/>
<property
name="price"
type="double"
update="true"
insert="true"
column="price"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Orders.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Orders o=(Orders)s.get(Orders.class,new Long(1));
System.out.println(o.getName());
o.setName("new Name");
o.setPrice(999);
s.saveOrUpdate(o);
s.flush();
Full stack trace of any exception that occurs: no exacption
Name and version of the database you are using: mySql 4
The generated SQL (show_sql=true):update orders set name=?, price=? where orderId=?
hi. i'm trying to change an object, but for some reasons the changes won't reflect in the database.