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

Difference between Systems programming language and Application programming languages

c# java python perl programming-languages

What are the differences between a systems programming language and Application programming language?

Doing multiple tasks at once? (combining a GUI related function to carryout some process)

c++ winapi user-interface console-application winsock

I'm sorry if the title sounds "off", but to elaborate further, this is my problem - Basically I've written a simple Winsock server which passes information (text messages) between connected clients...

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.