facebook

Object daved in database automatically before save action

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #313226 Reply

    amir55
    Participant

    Hi dear all

    I am surprised that my object is stored automatically without me invoking the save method!!

    I use jsf – spring 2.0 – hibernate 3.3 configuration.

    I use MyEclipse for spring IDE, JBoss 4.2.2 and MySql on Xp win PC.

    My User.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&#8221; >
    <hibernate-mapping package=”login.user” auto-import=”false”>
    <class name=”User” table=”users”>
    <id name=”id” column=”ID” type=”java.lang.Integer”>
    <generator class=”increment”/>
    </id>

    <property name=”userId” type=”java.lang.String” column=”UserId” length=”20″ />

    <property name=”firstName” type=”java.lang.String” column=”FirstName” length=”20″ />

    </class>
    </hibernate-mapping>

    in hibernate.cfg.xml I tried upadat and validate but the same problem of saving the object user once I change one property before I save it.

    <property name=”hibernate.hbm2ddl.auto”>validate</property>

    Any idea with my deep thanks

    Amir

    #313240

    support-swapna
    Participant

    amir55,

    We need not explicitly call the session.save() method to persist the object. Hibernate will automatically update the database when the state of the persistant object is modified inside a transaction.

    Hope this helps.

    #313243

    amir55
    Participant

    yes true so I had to go around that by creaiing a Status.java to hold my transiant objects

    many thanks

    Amir

    #313254

    support-swapna
    Participant

    amir55,

    Glad to know that you are all set.

    Do let us know if you have any issues.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Object daved in database automatically before save action

You must be logged in to post in the forum log in