save « Field « JPA Q&A





1. Hiberate save-update listener and ascertaining field changes    stackoverflow.com

Good day. I've implemented a Hibernate save-update listener by extending org.hibernate.event.def.DefaultSaveOrUpdateEventListener.DefaultSaveOrUpdateEventListener and overriding onSaveOrUpdate(SaveOrUpdateEvent e).

@Override
public void onSaveOrUpdate(SaveOrUpdateEvent evt) throws HibernateException {
    super.onSaveOrUpdate(evt);
    Object entity = evt.getEntity();
 ...

2. how to save data with identity field?    forum.hibernate.org

Hi, I've just studied about Hibernate for a few days. Without the identity field I can save or update it myself but I cannot do it when the table column is set to identity. So I'm wondering if there is a way to save the data into the table that contains the identity field? Please help me. TableStudent StudenID(int, identity, PK) ...

3. save() can change Collection fields    forum.hibernate.org

4. Need to save utf8 data in Oracle NVARCHAR2 field    forum.hibernate.org

I am trying to save chinese data in utf8 in an NVARCHAR2 field in Oracle 9i. Can anyone suggest what all I need to do in the hibernate configurations in order to ensure this. I understand the driver and dialects have to be that of Oracle. But do I need to set sql-type field to NVARCHAR2 ? Or is there something ...

5. inherently updating a field on cascade save    forum.hibernate.org

Hi, We are developing an application that needs to keep track of some kind of versioning information on the records of some specific tables. All those tables contain a field called N_IDF, and we need this field to be set to some value whenever a record is inserted or updated. At the moment, some tables that have this field (and therefore ...

6. Save data in Binary Field    forum.hibernate.org

Hi all, I am trying to save data on the binary field but when i am create the mapping file for the same it will create it as String... My code is : DataBase Field declaration is: ColumnName DataType Length hash1 binary 3 and my mapping file is : public class Ttcmcs046550Id implements java.io.Serializable { // Fields private String TClan; private ...

7. Access the value of autoinc field after save()    forum.hibernate.org

I'm using the latest hibernate and spring with MySQL 5.0.45 and am using the autoinc annotation in my model as follows: /** * @return the id */ @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getAddressId() { return addressId; } /** * @param id the id to set */ public void setAddressId(Long id) { this.addressId = id; } AddressDAO is declared as: public ...

8. change a field after save before flush    forum.hibernate.org

I am trying to update a field just after the save in a transaction. I see that the flush is not called and my assumption is since the object got updated the new value should be used when it tries to insert into the database. But I see that in the insert the old value is being used and I see ...