Commits

Jean-Pierre Bergamin committed 03a17f9

* Using Spring 3.0.5.RELEASE because of bug https://jira.springsource.org/browse/SPR-6636
* Virgo had to be upgraded to 3.0.5 also, using this guide: http://blog.sustia.com/2010/10/virgo-kernel-runtime-spring-library.html (without removing the .web dependencies)
* Using annotations for JpaListing

Comments (0)

Files changed (6)

greenpages-2.3.0.RELEASE/solution/greenpages.jpa/src/main/java/greenpages/jpa/JpaDirectory.java

     @SuppressWarnings("unchecked")
     public List<Listing> search(String term) {
         return em.createQuery(SEARCH_QUERY).setParameter("term", "%" + term.toUpperCase() + "%").getResultList();
+    	
+//    	//Metamodel model = em.getMetamodel();// Get the metamodel before the ROOTEntityType<Employee> Employee_ = model.entity(Employee.class)
+//    	
+//    	CriteriaBuilder cb = em.getCriteriaBuilder();
+//    	CriteriaQuery<Listing> c = cb.createQuery(Listing.class);
+//    	Root<Listing> listing = c.from(Listing.class);
+//    	//EntityType<Listing> Listing_ = model.entity(Listing.class);
+//    	Predicate condition = cb.like(listing.<String>get("lastName"), term);
+//    	c.where(condition);
+//    	TypedQuery<Listing> q = em.createQuery(c); 
+//    	return q.getResultList();
     }
 
 }

greenpages-2.3.0.RELEASE/solution/greenpages.jpa/src/main/java/greenpages/jpa/JpaListing.java

 
 import greenpages.Listing;
 
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
 /**
  * Basic implementation of {@link Listing} that is configured as a persistent type in JPA.
  */
+@Entity(name="Listing")
 public class JpaListing implements Listing {
-
+	@Id
+	@Column(name="LISTING_NUMBER")
+	@GeneratedValue(strategy=GenerationType.TABLE)
     private Integer listingNumber;
 
+	@Column(name="FIRST_NAME")
     private String firstName;
 
+	@Column(name="LAST_NAME")
     private String lastName;
 
+	@Column(name="EMAIL_ADDRESS")
     private String emailAddress;
 
     public Integer getListingNumber() {

greenpages-2.3.0.RELEASE/solution/greenpages.jpa/src/main/resources/META-INF/MANIFEST.MF

 Manifest-Version: 1.0
-Import-Bundle: com.springsource.org.eclipse.persistence;version="[1.0.
- 0, 1.0.0]",com.springsource.org.eclipse.persistence.jpa;version="[1.0
- .0, 1.0.0]"
+Import-Bundle: org.eclipse.persistence.core;version="[2.2.0, 2.3.0)",o
+ rg.eclipse.persistence.jpa;version="[2.2.0, 2.3.0)"
 Bundle-Vendor: SpringSource Inc.
 Bundle-Version: 2.3.0
 Tool: Bundlor 1.0.0.RELEASE
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: greenpages.jpa
 Import-Package: greenpages;version="[2.3, 2.4)",javax.persistence;vers
- ion="[1.0.0, 1.0.0]",javax.sql;version="0",org.apache.commons.dbcp;ve
+ ion="[2.0.3, 2.1.0)",javax.sql;version="0",org.apache.commons.dbcp;ve
  rsion="[1.2.2.osgi, 1.2.2.osgi]",org.springframework.beans.factory.an
  notation;version="[3.0, 3.1)",org.springframework.context.weaving;ver
  sion="[3.0, 3.1)",org.springframework.core.io;version="[3.0, 3.1)",or

greenpages-2.3.0.RELEASE/solution/greenpages.jpa/src/main/resources/META-INF/orm.xml

-<?xml version="1.0" encoding="UTF-8" ?>
-<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
-    version="1.0">
-    <package>greenpages.jpa</package>
-    <entity class="greenpages.jpa.JpaListing" name="Listing">
-        <table name="LISTING"/>
-        <attributes>
-            <id name="listingNumber">
-                <column name="LISTING_NUMBER"/>
-                <generated-value strategy="TABLE"/>
-            </id>
-            <basic name="firstName">
-                <column name="FIRST_NAME"/>
-            </basic>
-            <basic name="lastName">
-                <column name="LAST_NAME"/>
-            </basic>
-            <basic name="emailAddress">
-                <column name="EMAIL_ADDRESS"/>
-            </basic>
-        </attributes>
-    </entity>
-</entity-mappings>

greenpages-2.3.0.RELEASE/solution/greenpages.jpa/template.mf

 Import-Template: 
  org.springframework.*;version="[3.0, 3.1)",
  greenpages;version="[2.3, 2.4)",
- javax.persistence;version="[1.0.0, 1.0.0]",
+ javax.persistence.*;version="[2.0.3, 2.1.0)",
+ org.eclipse.persistence.*;version="[2.2.0, 2.3.0)",
  org.apache.commons.dbcp.*;version="[1.2.2.osgi, 1.2.2.osgi]",
  javax.sql;version="0"
 Import-Bundle: 
- com.springsource.org.eclipse.persistence;version="[1.0.0, 1.0.0]",
- com.springsource.org.eclipse.persistence.jpa;version="[1.0.0, 1.0.0]"
+ org.eclipse.persistence.core;version="[2.2.0, 2.3.0)",
+ org.eclipse.persistence.jpa;version="[2.2.0, 2.3.0)"
 Import-Package: 
  org.springframework.context.weaving;version="[3.0, 3.1)",
  org.springframework.transaction.aspectj;version="[3.0, 3.1)"

greenpages-2.3.0.RELEASE/solution/parent/pom.xml

 	<packaging>pom</packaging>
 
 	<properties>
-		<spring.version>3.0.0.RELEASE</spring.version>
+		<spring.version>3.0.5.RELEASE</spring.version>
 		<maven.test.failure.ignore>true</maven.test.failure.ignore>
 		<eclipselink.version>2.2.0</eclipselink.version>
 		<javax.persistence.version>2.0.3</javax.persistence.version>