Mapping Atomic Fields

Introduction

The field-descriptor maps a bean attribute into one JCR property. it can map any kind of atomic types (java primitive data types and their wrapper classes).

Based on our model defined here, the following field-descriptor can be used in the class 'PageInfo' to map the bean field "title" (String type) into the JCR property "graffito:title".

 
<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.PageInfo" jcrNodeType="graffito:PageInfo">
	<field-descriptor fieldName="title" jcrName="graffito:title" />	
	.... other descriptors ....
</class-descriptor>	
				

It is not necessary to specify the type in the field-descriptor. The Persistence Manager uses the java introspection to get information on the each atomic field.

Supported Types

Java TypeJcr Type
StringSTRING
Boolean, booleanBOOLEAN
Double, doubleDOUBLE
Integer, intDOUBLE
Long, longLONG
byte[]BINARY
java.io.InputStreamBINALRY
java.util.CalendarLONG (corresponding to Calendar.getTimeInMillis()
java.sql.TimestampLONG (corresponding to Timestamp.getTime()
java.util.DateLONG (corresponding to java.util.Date.getTime()

Due to some issues with Jackrabbit, Calendar, Timestamp and date are converted into JCR LONG. We plan to add other converters for those types in the next release. We plan also to support other java types (char, ...)