By: Dorris Viewed: 153236 times Printer Friendly Format
Sometimes, you want the Database to do some computation for you rather than in the JVM, you might also create some kind of virtual column. You can use a SQL fragment (aka formula) instead of mapping a property into a column. This kind of property is read only (its value is calculated by your formula fragment).
@Formula("obj_length * obj_height * obj_width") public long getObjectVolume()
The SQL fragment can be as complex as you want and even include subselects.
Most Viewed Articles (in Hibernate )
Latest Articles (in Hibernate)
Comment on this tutorial
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews