1

I am using the code is working for Derby, MySQL, Oracle but it's throwing error while using with PostgreSQL I'm getting error org.hibernet.exception.DataException could not execute the query.

I'm getting a solution to map text with String. But nowhere solution is for map text with Clob in domain class.

class Ticket {
    String id
    String name
    String customerId
    int severity
    Clob description
    String component
    Clob screenshot

    static mapping = {
        version false
        table 'MY_TICKET'
        id generator: 'assigned'
        columns {
            id column: 'TICKET_ID'
            customerId column: 'CUSTOMER_ID'
        }
    }

    static constraints = {
        id bindable: true
    }   
}
1
  • I followed the approach stackoverflow.com/questions/13420081/… so I'm able to see data. One place i'm making a call Ticket.get(id) which internally calling hibernate reflection for get calls and i'm getting the error saying org.springframework.orm.hibernate5.HibernateSystemException: Could not set Could not set field value [DESCRIPTION] value by reflection class Ticket.description. Commented Jan 5, 2019 at 9:08

1 Answer 1

1

You need to change the Clob type to String Type

class Ticket {
    String id
    String name
    String customerId
    int severity
    String description
    String component
    String screenshot

    static mapping = {
        version false
        table 'MY_TICKET'
        id generator: 'assigned'
        columns {
            id column: 'TICKET_ID'
            customerId column: 'CUSTOMER_ID'
        }
    }

    static constraints = {
        id bindable: true
    }  

     component sqltype:'text'
     screenshot sqltype:'text'
}

When we need to use a clob type in our mapping we always model it as a String with mapping type: 'text'.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, @Ajay it works for me. I saw sqltype and type what actually difference between these.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.