Hibernate crops clob values oddly

Question :

Hibernate crops clob values oddly,

Answer :

I have a one to many relationship between two tables. The many table contains a clob column. The clob column looks like this in hibernate:

@CollectionOfElements(fetch = EAGER)  @JoinTable(name = NOTE_JOIN_TABLE, joinColumns = @JoinColumn(name = "note"))  @Column(name = "substitution")  @IndexColumn(name = "listIndex", base = 0)  @Lob  private List substitutions;  

So basically I may have a Note with some subsitutions, say "foo" and "fizzbuzz". So in my main table I could have a Note with id 4 and in my NOTE_JOIN_TABLE I would have two rows, "foo" and "fizzbuzz" that both have a relationship to the Note.

However, when one of these is inserted into the DB the larger substitution values are cropped to be as long as the shortest. So in this case I would have "foo" and "fiz" in the DB instead of "foo" and "fizzbuzz".

Do you have any idea why this is happening? I have checked and confirmed they aren’t being cropped anywhere in our code, it’s defintely hibernate.


Many JDBC drivers, early versions of Oracle in particular, have problems while inserting LOBs. Did you make sure that the query Hibernate fires, with the same parameters bound works successfully in your JDBC driver?

That’s the answer Hibernate crops clob values oddly, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you

Read More  Cannot Add a Sql Server Login