Skip to content
stemey edited this page Oct 21, 2012 · 10 revisions

The standard pojo repository scans the classpath and creates all types at startup. The other repository creates types lazily. This makes the configuratio easy and creates no startup delay. But the known subtypes are not provided reliably.

Collection and map properties need to be annotated to give Atem access to the target type.

@Association(targetType=Person.class)
private List<Person> people;

@MapAssociation(targetType=Pet.class,keyType=String.class)
private Map<String,Pet> pets;

The classes created can be restricted to a certain package. If the requested class is not member of that package or its subpackages then no enttiy type will be created. The Type of the instantiated EntityType can be defined. You can define whether you would like only java bean proeprties to be exposed or direct field access. This is similar to how settings in JPA.

The basic configuration looks like this (see also pojo-example]):

<import resource="/atem/pojo/entitytype.xml" />
<import resource="/atem/pojo/entitytype-example.xml" />

<bean id="my-pojo-repository" parent="atem-scanned-pojo-repository">
	<property name="includedPackage" value="package of pojo" />
</bean>

For a lazy pojo repository it looks similar

<import resource="/atem/pojo/entitytype.xml" />
<import resource="/atem/pojo/entitytype-example.xml" />

<bean id="my-pojo-repository" parent="atem-pojo-repository">
	<property name="includedPackage" value="package of pojo" />
</bean>