Java Persistence with Hibernate 2nd phần 1 pptx
... domain model 11 0 Addressing leakage of concerns 11 1 ■ Transparent and automated persistence 11 2 ■ Writing POJOs and persistent entity classes 11 3 ■ Implementing POJO associations 11 6 Adding logic ... 606 ■ Controlling the second-level cache 611 13 .5 Summary 612 14 Querying with HQL and JPA QL 614 14 .1 Creating and running queries 615 Preparing a query 616 ■ Executing...
Ngày tải lên: 12/08/2014, 19:21
... mDate); The same query and code looks slightly different in Java Persistence: 616 CHAPTER 14 Querying with HQL and JPA QL 1 Create the query, with any arbitrary restriction or projection of data that you ... example). Hibernate and Java Persistence offer query interfaces and methods on these inter- faces to prepare and execute arbitrary data retrieval operations. 14 .1. 1...
Ngày tải lên: 12/08/2014, 19:21
... xsi:schemaLocation="http:/ /java. sun.com/xml/ns /persistence http:/ /java. sun.com/xml/ns /persistence/ persistence _1_ 0.xsd" version=" ;1. 0"> < ;persistence- unit name="helloworld"> ... into persistence. xml (see listing 2 .13 ). < ;persistence- unit name="helloworld"> <provider>org .hibernate. ejb.HibernatePersistence</pr...
Ngày tải lên: 12/08/2014, 19:21
Java Persistence with Hibernate 2nd phần 3 pot
... BY 1 START WITH 1 </parameter> </generator> </id> You can use Hibernate identifier generators with annotations, even if no direct annotation is available: @Entity @org .hibernate. annotations.GenericGenerator( ... tricks along the way that help you deal- ing with nonperfect table layouts. 5 .1. 1 Table per concrete class with implicit polymorphism Suppose w...
Ngày tải lên: 12/08/2014, 19:21
Java Persistence with Hibernate 2nd phần 4 potx
... right one). Without extending Hibernate, you can choose from the following collections: ■ A java. util.Set is mapped with a <set> element. Initialize the collection with a java. util.HashSet . ... Ini- tialize with a java. util.ArrayList . ■ A java. util.Collection can be mapped with <bag> or <idbag> . Java doesn’t have a Bag interface or an imple...
Ngày tải lên: 12/08/2014, 19:21
Java Persistence with Hibernate 2nd phần 5 potx
... cases. Also note that this mapping Figure 7 .15 Using a discriminator column with an any association 318 CHAPTER 7 Advanced entity association mappings Hibernate executes a UNION query to retrieve ... bytecode instru- mentation, you don’t need to load the lazy properties. See chapter 13 , sec- tion 13 .1. 6, “Lazy loading with interception.” The {propertyName} aliases as shown i...
Ngày tải lên: 12/08/2014, 19:21
Java Persistence with Hibernate 2nd phần 6 pps
... level (the database) and how you work with transactions in an application that is based on native Hibernate, on Java Persistence, and with or without Enterprise JavaBeans. Transactions allow you ... at Hibernate and Java Persistence features for pessimistic and opti- mistic concurrency control at the application level, and what other isolation guar- antees Hibernate can provi...
Ngày tải lên: 12/08/2014, 19:21
Java Persistence with Hibernate 2nd phần 7 ppt
... custom org .hibernate. usertype.UserVersionType .) 498 CHAPTER 11 Implementing conversations 11 .3 .1 Persistence context propagation in Java SE Consider again the controller from listing 11 .1. This ... Table 11 .2 Hibernate and JPA comparison chart for chapter 11 Hibernate Core Java Persistence and EJB 3.0 Persistence context propagation is available with thread or...
Ngày tải lên: 12/08/2014, 19:21
Java Persistence with Hibernate 2nd phần 9 pps
... are the same. Java Persistence standardizes JPA QL and also allows the fallback to native SQL. 15 .2.3 Native SQL in Java Persistence Java Persistence supports native SQL queries with the createNativeQuery() method ... layer 711 16 .2.2 Implementing the generic CRUD interface Let’s continue with a possible implementation of the generic interface, using Hibernate APIs:...
Ngày tải lên: 12/08/2014, 19:21
Java Persistence with Hibernate 2nd phần 10 pps
... method, with literal arguments. Figure 17 .11 Seam decorates the input fields with validation error messages. The Java EE 5.0 programming model 759 You can call the session bean shown in listing 17 .4 ... JSF configuration in listing 17 .6. The backing bean declaration is gone (moved to two Seam annotations on the EJB). The phase Listing 17 .11 The JSF configuration file without ba...
Ngày tải lên: 12/08/2014, 19:21