Hi folks,
I'd the problem that I was getting the error in the subject when I tried
to insert a string of greater length than the database table declaration.
i.e. my Response object has a statusLine string. If this string was greater
than 255 for instance I'd get the error. So I implemented an overflow table
for such strings.
Basically the constructor of the Response object splices the incoming string
into a statusLine that contains the first 255 chars and then the rest gets
put into the overflow string.
Here's the constructor.
Code:
public void setStatusLine(String statusLine) {
if (statusLine.length() > 255) {
// Creates a new String instance for the substring from 0,255
this.statusLine = new String (statusLine.substring(0, 254));
// Creates a new String instance for the substring from 255 to the end.
setOverflow(new Overflow(new String (statusLine.substring(254, statusLine.length()))));
} else {
this.statusLine = statusLine;
}
}
For an initial statusLine of 1000 chars, the first 255 goes to the global
statusLine object and the remainder goes into the Overflow object.
when it comes to inserting this Response object, the overflow object goes
in fine and only contains the remainder of the initial string i.e. 745 chars.
however when it comes time to insert the statusLine object the whole
string (all 1000 chars is returned from the method
Code:
Object[] values = persister.getPropertyValuesToInsert(entity, source);
in the AbstractSaveEventListener.
however debugging the Response object at that point shows that the
statusLine string encapsulated in the object only has 254 chars?
Basically there's something going on with the CGLib libraries when it goes
to retrieve the object.
Has anyone any idea how the CGLib retrieves the values for the insert?
Thanks,
Mark.