HZGroup.Persistencelaye's lasting layer will soon release the source code online, please pay attention to one, system configuration
The persistence layer will depend on three XML configuration files
1) Pulse layer configuration file: The following is called ApplicationContext.xml, which contains system data source information, cache information, cursor size, etc.
2) A set of mappings: The following is called hzgroup.classmap.xml, which contains object relationship mapping information.
3) A set of associated mappings: The following is called hzgroup.association.xml, including the class association relationship
In order to improve the operating efficiency of the persistence layer, the above configuration file is running to memory at one time when running throughout the system. If the configuration file is modified, you can reload it through the method.
operating
The persistence layer entity integrates the real part of the entity, such as INSERT, UPDATE, DELETE, RETRIEVE operation, when we want to operate the entity, these methods can be used directly to implement the operation control.
// Add new update operation
Customer Customer = New Customer (); Customer.Id = "001"; Customer.Name = "IBM China Branch"; Customer.Update ();
// Delete operation
Customer Customer = New Customer (); Customer.Id = "001"; Customer.delete ();
// Object Get
Customer Customer = New Customer (); Customer.Id = "001"; customer.Retrieve (); Transaction transaction, support for simple single database and multi-data transaction operations
Transaction t = new transaction (); // instantiate a transaction t.begintransaction () T. ROLLBACKTRANSACTION () T.COMITTRANSACTION ()