I'm using Java 6, Hibernate 4.1.0.Final, and Spring 3.1.1.RELEASE. I have a String (maximum of 32 characters) that I wish to convert to a number and then back again to a String. I want to know what MySQL (v 5.5) data type I should use to store the number (which I think is a BigInteger) and I would also like to know if there's a better way to do the conversion. Right now, I'm doing
// Convert to integer
final BigInteger bigInt = new BigInteger(myString.getBytes());
// Convert back to a string
final String oldString = new String(bigInt.toByteArray());
The Hibernate mapping on the field in question is
@Column(name = "ORDER_ID")
private BigInteger orderId;
Thanks for your help, -