126 CHAPTER 6 n MAPPING WITH ANNOTATIONS (Web design rates) CHAPTER

126 CHAPTER 6 n MAPPING WITH ANNOTATIONS CHAPTER 6 n MAPPING WITH ANNOTATIONS
jdbc:hsqldb:file:annotationsdb;shutdown=true sa 0 false org.hibernate.dialect.HSQLDialect You can also add an annotated class to your Hibernate configuration programmatically. The annotations toolset comes with an org.hibernate.cfg.AnnotationConfiguration object that extends the base Hibernate Configuration object for adding mappings. The methods on AnnotationConfiguration for adding annotated classes to the configuration are as follows: addAnnotatedClass(Class persistentClass) throws MappingException addAnnotatedClasses(List classes) addPackage(String packageName) throws MappingException Using these methods, you can add one annotated class, a list of annotated classes, or an entire package (by name) of annotated classes. As with the Hibernate XML configuration file, the annotated entities are interoperable with XML mapped entities. Hibernate 3 Specific Persistence Annotations Table 6-2 lists the Hibernate-specific annotations. We will now look at some of these Hibernate- specific annotations in more detail however, bear in mind that using any of this functionality potentially reduces the portability of your application to other EJB 3 solutions. Annotations that are not recognized by an EJB 3 environment will be ignored, rather than causing a runtime exception directly however, this may result in different runtime application behavior that may not be desirable. In some cases, Hibernate 3 annotations can be used to prepare resources that are referenced by standard EJB 3 annotations, in which case the application will fail when the EJB 3 environment attempts to use the missing resource.
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision make web site services

Leave a Reply