Apache Derby Part 3
You can use the SQL client tool, such as “SQuirreL SQL Client” for creating the tables and managing your data. At the first time, even you log in as your decided user name, the schema that related to user name has not be presented. It will presented after you have finished creating a least one table. My previous post mention about “the system will prompt you to provide the default schema, at the moment please choose “APP”. At the moment, you have your own schema which is related to your user name already. After you connect to your database via NetBeans you can extract your connection node and choose your schema as a default schema by right click at the schema which same as your user name and choose “Set as Default Schema”. It’s nice to create some tables for further using via the JPA. I prefer to have at least 3 tables as following: –
1. The master table as a parent.
2. The detail table as a child of the master with one-to-many relationship.
3. The lookup table for the master table with one-to-one relationship, e.g. the constant table which contains code and description.
Since someone told me that there is an interesting feature for Java EE 6: JPA 2.0, so that you can manage the child data via the POJO accessing through LIST or COLLECTION e.g. create new elements, update or delete elements. When save the parent object, all related child objects changing will be applied automatically without any line of code. I’m not sure if it is called “Cascading Persist” or not.
Later I will find further information and try my best to prove it.