Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring with Hibernate JPA using Virtual database columns not working
    text
    copied!<p>I have a scenario like where i have an Entity with variable (say x) which points to Virtual column in DB. I used this variable x just to project some data onto UI or so and don't want that to be inserted or updated when Iam updating or creating the entity object.</p> <p>For this to be achieved i have introduced insertable and updatable to be false as shown below</p> <pre><code> @Column(name = "VIRTUAL_COLUMN_NAME_IN_DB", length = 4000, updatable = false, insertable = false) private String x; </code></pre> <p>I have introduced associated getters and setters as well.</p> <p>With the annotations i introduced, i expected variable x to be not included part of insert or update opeartions</p> <p>But, its not the case and i see it coming up in insert and update operations, which inturn causing me have a DB error below</p> <pre><code>org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [99999]; error code [54017]; ORA-54017: UPDATE operation disallowed on virtual columns ; nested exception is org.hibernate.exception.GenericJDBCException: ORA-54017: UPDATE operation disallowed on virtual columns at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:651) at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:105) </code></pre> <p>Please let me know how to use virtual columns in Spring based application with Hibernate JPA</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload