Read Me
This is a simple implementation of JPA 1.0
Features
=======
- uses simple JDBC and SQL
- maps a class automatically at first usage
- allows multiple primary keys (specified by @Id, and in case of multiple @IdClass), no @EmbededId
- only one of the primary keys are allowed to be generated by DB, Java generation available based on UUID
- @Entity name is considered to be tablename, @Table is also allowed
- Map contains className, tableName, List of primaryKey, idClass, column map (classField >tableField), column type map, gemerationType map
- uses class field names for mapping (needs AS, very usefull when mapping from complex selects to class)
* ignores named parameters which are not appearing in SELECT (issues a warning log)
* ignores those fields from the SELECT which are not in the class (issues a warning log)
* issues an error log when there is a field in the class which is not there in the SELECT (continues the mapping, returning the result)
- generate simple SQL for INSERT (persist), UPDATE (merge), SELECT <all fields> WHERE <primary key>=? (find)
- can use named parameters starting with colon :classFieldName
- when class is given, replace SELECT * FROM ... => SELECT table_field1 as classField1, (all fields in same format) FROM ...
- add automatically AS to those columns in SELECT where is missing
* SELECT table_field1 , table_field2 FROM ... => SELECT table_field1 AS classField1 , table_field2 AS classField1 FROM ...
- can handle alias in those above
* SELECT v.* FROM tableName v => SELECT v.table_field1 AS classField1, v.table_field2 AS classField2,... (all fields) FROM ...
* SELECT v.table_field1 FROM ... => SELECT v.table_field1 AS classField1 FROM ...
- recognizes entity (if not explicily given ) in entityManager.createNativeQuery
when simplejpa.recognize_class property is configured true in persistence.xml
- refresh on merge is optional controlled by property in persistence xml : simplejpa.refresh_on_merge
- a java side id generation using random UUID
when simplejpa.generatedValue_auto_from_java property in persitence.xml, GenerationType.AUTO
- has a SimpleReverseMapper for generating java classes from Db, annotated with Primary class in case of multiple @Id
-