Spring with Hibernate JPA using Virtual database columns not working -
i have scenario have entity variable (say x) points virtual column in db. used variable x project data onto ui or , don't want inserted or updated when iam updating or creating entity object.
for achieved have introduced insertable , updatable false shown below
@column(name = "virtual_column_name_in_db", length = 4000, updatable = false, insertable = false) private string x;
i have introduced associated getters , setters well.
with annotations introduced, expected variable x not included part of insert or update opeartions
but, not case , see coming in insert , update operations, inturn causing me have db error below
org.springframework.orm.hibernate3.hibernatejdbcexception: jdbc exception on hibernate data access: sqlexception sql [n/a]; sql state [99999]; error code [54017]; ora-54017: update operation disallowed on virtual columns ; nested exception org.hibernate.exception.genericjdbcexception: ora-54017: update operation disallowed on virtual columns @ org.springframework.orm.hibernate3.sessionfactoryutils.converthibernateaccessexception(sessionfactoryutils.java:651) @ org.springframework.orm.jpa.vendor.hibernatejpadialect.translateexceptionifpossible(hibernatejpadialect.java:105)
please let me know how use virtual columns in spring based application hibernate jpa
have tried @transient annotation? supposed that: "this annotation specifies property or field not persistent. used annotate property or field of entity class, mapped superclass, or embeddable class."
https://docs.oracle.com/javaee/5/api/javax/persistence/transient.html
Comments
Post a Comment