Home > Object Persistency API > API Reference > jSDL
jSDL is an elegant way to instantiate entities and attribute objects within Java.
Consider for example an entity class Person with two fields: firstName and lastName. Then a person can be instantiated and initialized like this:
Person person = Person( firstName("Christian"), lastName("Merenda") );
For sure you can initialize your person with the firstName but not with the lastName as well.
Person person = Person( firstName("Christian") );
This is implemented with a set of automatically generated static methods. So the only thing you need to do is to import these methods.
import static org.oomega.demo.persistency.pedigree.jSDL.Person; import static org.oomega.demo.persistency.pedigree.Person.P.firstName; import static org.oomega.demo.persistency.pedigree.Person.P.lastName;
The Person entity class is part of the metapackage org.oomega.demo.persistency.pedigree.
- There's a jSDL class generated for every metapackage. It contains the static methods for constructing entity and attribute objects.
- There's an inner class P generated for every entity and attribute class. It contains the static methods for setting properties within construction methods.
Next chapter: SDF and SDML