I’m using the TopLink persistence library with the MySQL db in my Java applications.
I’ve developed the class library which is used by several desktop applications, it contains some classes that are specific for my project. Classes are linked to each other, generally with one-to-many relationships.
I want to have DB Entity classes and Project-specific classes to be separate.
How should I develop the communications between this classes (inheritance, using or something?). How should the relationships between project-specific classes be developed when loading(or putting) them to the database?
I guess since it’s a desktop application, it’s a UI based application. So MVC architecture is most suitable here. Also I guess you would have to use Java beans for asynchronous access to the model.
First define a model with all definition required.
let say
Now we need a model provider, which would be a singleton pattern.
Now on the UI part you first need to get instance of model provider, and carry all further interaction through model provider.