How to configure “hibernate-mapping” to “field”

I want to specify via standard JPA Persistence.createEntityManagerFactory(String,Map<String,String>) to hibernate to use "hibernate-mapping" to "field" rather than "property".

How can I do this, the clean way?

Answers


JPA determines which mapping type to use based on where you put your @Id annotation. So if you put your @Id annotation on a field then the mapping will be field-based.

UPDATE:

In JPA 2.0 You can also use the @Access annotation. You can apply it to the class to specify the access type for the entire entity and you can apply it to individual fields/methods to override the default for a single field/property.


Need Your Help

IMAP - difference between msgno and uid?

php imap

What is the difference between msgno and uid? It looks like they always are the same even if msgs are deleted!?

Working with suffix trees in python

python hash suffix-tree

I'm relatively new to python and am starting to work with suffix trees. I can build them, but I'm running into a memory issue when the string gets large. I know that they can be used to work with...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.