Constant in Hibernate Mapping Files -


I would like to add a value object to the mapped class, where a column is fixed on the basis of a fixed class. How can I do something like this?

  & lt; Component name = "aComponent" & gt; & Lt; Property Name = "abc" column = "cde" /> & Lt; Property name = "xyz" value = "vested" /> & Lt; / Component & gt;  

Unfortunately, the value attribute is not present. Is there another way to apply a fixed price for the property?

Thanks in advance.

You should use a formula, such as

  & lt ; Property name = "xyz" formula = "1" type = "big_decimal" />  

Persistence with Hibernate, ch 4.4.1:

given the SQL formula every time the unit is obtained from the database (and Not at any other time, therefore the result may be outdated if other properties are modified). The property does not contain a column attribute (or sublement) and is never visible in a SQL INSERT or UPDATE , only in SELECT s The Formula database can refer to the table of the table, they can call the SQL function, and they can also include SQL objects. The built-in database is passed in the form of SQL expression; This is a good opportunity to bind your mapping file to a specific database product, if you are not careful and rely on vendor-specific operators or keywords.


Comments