Hi Matt,
Is this NPE being thrown from Hibernate? (A stack trace would clarify
this). I'm surprised that your db isn't throwing a different exception
than an NPE. Nevertheless, I haven't seen an automatic way to do this
(i.e. built into Hibernate).
I think users would be surprised if they entered in a bunch of data into
an field that the Application didn't truncate only to have the data
truncated in the datastore and returned back to the user incomplete.
Maybe you're thinking of a different use case.
Brian
Arnett, Matt wrote:
Is there a way to have hibernate automatically trim field lengths that
exceed the maximum as dictated by the database? If you try to persist
a field that exceeds a maximum length you get a very helpful
java.lang.NullPointerException.
Thanks,
-Matt
This e-mail transmission contains information that is intended to be
confidential and privileged. If you receive this e-mail and you are
not a named addressee you are hereby notified that you are not
authorized to read, print, retain, copy or disseminate this
communication without the consent of the sender and that doing so is
prohibited and may be unlawful. Please reply to the message
immediately by informing the sender that the message was misdirected.
After replying, please delete and otherwise erase it and any
attachments from your computer system. Your assistance in correcting
this error is appreciated.
|