Skip to content

Commit

Permalink
[resolves wildfly-extras#6], [resolves wildfly-extras#56]. Use plain …
Browse files Browse the repository at this point in the history
…jee jpa instead of hibernate. Also add generated dirs to gitignore list
  • Loading branch information
jamesnetherton committed Nov 7, 2014
1 parent 7df9907 commit 309b03f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.settings
target
*.iml
input
2 changes: 0 additions & 2 deletions examples/camel-jpa/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions examples/camel-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.5.Final</version>
<scope>provided</scope>
</dependency>

<!-- Test Scope -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
*/
package org.wildfly.camel.examples.jpa;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.wildfly.camel.examples.jpa.model.Customer;

import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import java.util.List;


Expand All @@ -40,8 +40,10 @@ public class CustomerRepository {
@SuppressWarnings("unchecked")
public List<Customer> findAllCustomers() {

Session session = (Session) em.getDelegate();
Criteria criteria = session.createCriteria(Customer.class);
return (List<Customer>) criteria.list();
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Customer> query = criteriaBuilder.createQuery(Customer.class);
query.select(query.from(Customer.class));

return em.createQuery(query).getResultList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ limitations under the License.
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="camel">
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
<class>org.wildfly.camel.examples.jpa.model.Customer</class>
</persistence-unit>
</persistence>

0 comments on commit 309b03f

Please sign in to comment.