Looking for the latest version? Download easy-jpa-3.0-alpha.jar (48.5 kB)
Name Modified Size Downloads / Week Status
Totals: 8 Items   328.3 kB 5
3.0-alpha 2011-05-20 11 weekly downloads
2.0-alpha 2011-05-16 0
1.0-alpha 2011-05-16 0
readme.txt 2011-05-25 2.7 kB 11 weekly downloads
CriteriaProcessorTest.java 2011-05-06 21.7 kB 11 weekly downloads
gpl-3.0.txt 2011-05-06 35.1 kB 11 weekly downloads
easy-jpa-1.0-alpha-SNAPSHOT-javadoc.zip 2011-05-06 226.9 kB 11 weekly downloads
easy-jpa-1.0-alpha-SNAPSHOT.jar 2011-05-06 41.9 kB 11 weekly downloads
----------------------------------------------------------------------------------------------------- NOTE: THIS PROJECT IS RENAMED TO EASY-CRITERIA (https://sourceforge.net/projects/easy-criteria/). ----------------------------------------------------------------------------------------------------- Tired of writing SQL in Java? Afraid of fragility of named queries?  Want to write metadata based type-safe queries, but lost in verbose JPA api? Then this framework is for you. Now you can now write metadata based, type-safe, debugable, readable, and maintainable queries in Object Oriented way easily. No prior knowledge of SQL or JPA required. ----------- HOW TO USE: ----------- There are two main classes in this framework; 1- CriteriaComposer, 2- CriteriaProcessor Use CriteriaComposer to construct your query using one or all of the following constructs: Select, Where, Group by, Order By, Join, Logical Operators (AND, OR, NOT), Comparison Operator (EQUAL, LIKE, IN, etc..), AggregateFunction (SUM, COUNT, AVERAGE, etc..). Use CrieriaProcessor to execute this query and get the results. There are two types of API in this class; 1- Entity based, 2- Tuple based Use Entity based API when you want to get all columns of the root entity. Use Tuple based API when you to retrieve selected columns from one or more than one entities. Please note that Entity based API ignores the Select clause that you may have in you criteria. ----------- EXAMPLE 1: SQL : select person.name, sum(course.unit) from person inner join course_session inner join course group by person.name ----------- CriteriaComposer<Person> studentUnitCount = CriteriaComposer.createComposer(Person.class).select(Person_.name).groupBy(Person_.name); studentUnitCount.join(Person_.courseSessions).join(CourseSession_.course).select(AggregateFunction.SUM, Course_.unit); List<Tuple> result= criteriaProcessor.findAllTuple(studentUnitCount); for(Tuple tuple: result) System.print(tuple.get("Person.name")); Alternatively you can define your own alias e.g. {select(Person_.name, "name")}. This alias should be unique across your criteria, if you select another column with the same alias e.g.{select(Course_.name, "name")} then it would result in an error. ----------- EXAMPLE 2: SQL: select * from course where course.last_update_date_time between ? and ? ----------- CriteriaComposer<Course> courseCriteria = new CriteriaComposer<Course>(Course.class); criteria.where(Course_.lastUpdateDateTime, ComparisonOperator.BETWEEN, thatDate, toDate); List<Course> result = criteriaProcessor.findAllEntity(courseCriteria);
Source: readme.txt, updated 2011-05-25