Hi all,
I've got a db table (Oracle9) which has a fixed character field as PK (trn_id CHAR(16)). Problem is that the values in this field are not always 16 characters long which means Oracle adds as many spaces as necessary to get to 16. I've now done a Hibernate mapping of this table using the string type to map this field. Queries do work but only if i manually add the spaces to the value before setting it.
Does not work:
Transaction t = (Transaction) trnQuery.setParameter("tnid","04218361151C4WR",Hibernate.STRING).uniqueResult();
Does work:
Transaction t = (Transaction) trnQuery.setParameter("tnid","04218361151C4WR ",Hibernate.STRING).uniqueResult();
I also tried using a custom type which trims the value but it seems the methods of this CustomType are never called when setting a query parameter.
Any hints how to solve such mappings?
thx
Roman
|