I don't think it has anything to do with Hibernate. It's probably the JDBC driver. I don't use Oracle, but tracing the problem in my hand is telling me that. If you want Hibernate to throw an exception, I suggest you specify the Hibernate type. To be honest, I've never used char(1) with Hiberante before (just with other applications). If you stored this is a string, I don't think Hibernate would know that the underlying type is really a single char. Perhaps use type="char" instead? That would add the necessary type checking. If you decided to use a string, I'm sure Hibernate would throw something in that case. Just experiment to find the answer really.
For me, I try and put all of my validation in the domain layer so this sort of stuff doesn't happen when it reaches the db.
|