Advertisement
Guest User

Untitled

a guest
Jul 20th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. entityManager.createQuery("SELECT u FROM PlantEntity u order by idPlant").setFirstResult(0).setMaxResults(10).getResultList();
  2.  
  3. Session hs = (Session) entityManager.getDelegate();
  4. Criteria c = hs.createCriteria(PlantEntity.class,"plant");
  5. c.setMaxResults(Integer.parseInt(length));
  6. c.setFirstResult(Integer.parseInt(start));
  7. c.list();
  8.  
  9. <?xml version="1.0" encoding="UTF-8"?>
  10. <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
  11.  
  12. <persistence-unit name="NewPersistenceUnit">
  13. <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
  14.  
  15. <class>it.ciro.model.PlantEntity</class>
  16. <class>it.ciro.model.SegmentEntity</class>
  17. <class>it.ciro.model.PlanningEntity</class>
  18. <properties>
  19. <property name="hibernate.connection.url" value="jdbc:postgresql://94.23.66.103:5432/db"/>
  20. <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
  21. <property name="hibernate.connection.username" value="xxxx"/>
  22. <property name="hibernate.connection.password" value="xxxxx"/>
  23. <property name="hibernate.archive.autodetection" value="class"/>
  24. <property name="hibernate.format_sql" value="true"/>
  25. <property name="hibernate.connection.useUnicode" value="true" />
  26. <property name="hibernate.connection.characterEncoding" value="UTF-8" />
  27. <property name="hbm2ddl.auto" value="validate"/>
  28. <property name="hibernate.c3p0.min_size" value="5" />
  29. <property name="hibernate.c3p0.max_size" value="20" />
  30. <property name="hibernate.c3p0.timeout" value="60" />
  31. <property name="hibernate.c3p0.max_statements" value="50" />
  32. <property name="hibernate.c3p0.idle_test_period" value="90" />
  33. <property name="hibernate.c3p0.preferredTestQuery" value="SELECT 1" />
  34. <property name="hibernate.c3p0.testConnectionOnCheckout" value="true" />
  35. </properties>
  36. </persistence-unit>
  37. </persistence>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement