Archiwum dla OneToMany

extended example

Posted in entities mapping, entity, hibernate, java ee, Java Persistence API, jpa, mapping with tags , , , , , , on 19 stycznia, 2008 by eyemirror

The good news is, finally I mapped my model using Hibernate’s entities that perfectly fits to my DB model. Only this time I started with creating db tables and then force Hibernate to persist data to right table in right way.

On the other hand I am not so sure if people are doing things this way. I should rather think in terms of object and relationships they have and don’t care about backstage operations (that is hard if you know sql a bit). Well I really don’t have much experience about ORM’s performance in big scale, but as objects are cached and people use that I think it provides good trade-off between simplicity and speed. And it is perfect to start project and then optimize specific queries in native SQL dialect/adding cache and so on – using plain SQL will not guarantee any speed-up.

UML diagrams
uml model

Entities

  1. here is the zip file with chosen entities from my project (not all of them). To unzip the file use the password ‚djshadow‚ :) hell yeah (I am using 7zip softwear)
  2. customer entity is a base class for all concern, owner, service and integrator classes. each concern can be owner as well and each integrator can be service. There is a ManyToMany relationship between service and station split into 2 OneToMany relationships that is holding additional filed for that relationship

//TODO
get reed of relationship annotations and move them to xml file where they can be changed easily without recompiling classes.