java - Mapping Calculated Fields in Hibernate -


I'm not sure that it is possible to be in hibernation but it would really be great if it was :) I do not really With this I have got in the perceptual stage but I can understand as much as I can.

I want to use Oracle spatial features to search closely. Imagine that I've got a location unit that stores the value of latitude / latitude. Again imagine that I want to query for all the locations within 5 km of the user's specified latitude / longitude space. In the results, I want to see all the matching places, but in addition to the standard mapped areas on the location unit, I want to present the distance of each location relative to the user's specified location.

Oracle Locals do this in the form of a calculated field in SQL, but I do not understand how many fields in Hibernation that can come back from the database. As the calculated field table does not contain a column, I can not do a standard mapping.

Are there some special features that allow me to make rappers for POJO and give them a hibernate map, such as additional calculating properties can be returned?

I've found, using JPA annotations, that I'm just one of your computed SQL fields Property on the mapped object with the same name as ("distance") and comment like this:

  @Column (insertable = false, updatable = false) Private double distance ;  

And this property should be mapped and you should not make any errors when you are trying to save it from DB.

Please note that the correct annotation is updateable (not updated as it was originally posted)


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -