简体   繁体   中英

Hibernate, Java, inserting 3 decimal points

I'm creating a simple struts 2 web app utilizing Hibernate. I'd like the user to be a able to enter 3 items.

Environment: eg "Windows" Version: eg 10.2.0 Notes: eg "Windows is the beez kneez"

However I'm not sure what primitive data type I would use for Version as it has 2 decimals when creating my Java Object? Is it a Float? is it a Double? How would I approach it if it was something like 10.2.3.5?

Decimal values contain a single decimal. If you want multiple decimals, you'll need a string.

java.text.DecimalFormat 

Using this class would be a better approach

This link might help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM