Home JPA: ignore field on select, but update(Hibernate Save or Update)
Reply: 0

JPA: ignore field on select, but update(Hibernate Save or Update)

user1323 Published in April 25, 2018, 10:54 am

I've a situation where I need to save or update user data but not want to include one field while fetching(lastUpdateTime). But while updating the row, I want to update the row if any changes are there with the lastUpdateTime column.

I saw other posts and came to know that updatable=false is the way to exclude update, but is there anything which is like 'selectable=false' or something like this?

Thanks for the help in advance.

Save Or Update Code

public void insertData(Table obj) {
    Session session = DbConnectionFactory.getSessionFactory().openSession();
    Transaction tx = null;
    try {

        tx = session.beginTransaction();

    } catch (Exception ex) {
        if (tx != null)
        // _log.error(ex,ex);
        obj = null;
        logger.log(Level.SEVERE, "Failed to Insert into Table");
    } finally {
        if (session != null) {


Code Used to Insert Data


objectList contains the lastUpdateTime as well.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.317666 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO