CHAPTER 3 Domain models and metadata
auction.model This XML is automatically picked up by the JPA provider if you place it in a file called orm.xml in your classpath, in the META-INF directory of the persistence unit. You can see that you only have to name an identifier property for a class; as in annotations, all other properties of the entity class are automatically considered persistent with a sensible default mapping. You can also set default mappings for the whole persistence unit, such as the schema name and default cascading options. If you include the element, the JPA provider completely ignores all annotations on your entity classes in this persistence unit and relies only on the mappings as defined in the orm.xml file. You can (redundantly in this case) enable this on an entity level, with metadata-complete=”true”. If enabled, the JPA provider assumes that all properties of the entity are mapped in XML, and that all annotations for this entity should be ignored. If you don t want to ignore but instead want to override the annotation metadata, first remove the global element from the orm.xml file. Also remove the metadata-complete=”true” attribute from any entity mapping that should override, not replace, annotations:
auction.model Here you map the initialPrice property to the INIT_PRICE column and specify it isn t nullable. Any annotation on the initialPrice property of the Item class is
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.
This entry was posted
on Tuesday, November 20th, 2007 at 6:05 am and is filed under PHP5.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.