java - Insert float value to Mysql with Hibernate -
I am trying to save the float value in my MySQL db. However, the code below was applied with no errors, the row in the DB is not inserted. I'm guessing that this is an "F" in my float value
How can I overcome this issue?
Thank you!
userbeam = tailbean = new UserBean (); Tailbean.setImei (555555559999f); Tailbean.setName ("RAW"); Tailbean.setPassword ("hhh"); Session = getSession (); Session.beginTransaction (); Session.save (tailbean); Committed to session.getTransaction (). Session.close ();
You are creating a proper Java float, its value in F is not included. , F is primarily for the compiler to understand that this is a temporary number at the first place, but since then it is considered to be a proper float number. The number for the number is probably too large float : There are 32 bits in it and the number you enter is not fit in this kind of range. Perhaps you will need to use double and suffix D ?
Comments
Post a Comment