I have a maven project which contains some entities which are stored in a database. The purpose of this project is to manage personal information, users, locations, etc. This project can work on its own.

I also have a project which depends on the first which imports data into the database. But it's more than a simple import so it needs additional information to these entities. This information is only needed if it's imported data otherwise it is not set.

The problem

The problem is that I don't know how to "attach" this information to the entities in the first project without declaring them there. It wouldn't make sense to declare them there because the y don't belong there and it would just mix two domains. Putting both projects into one is not an option either because both are already big and still growing.

Approach to the problem

One approach I was thinking of is to use another entity which contains all information needed in the importer project and associate it with the original entity. This would almost work but it would create a terrible database model which I would never create if I wouldn't use an ORM.

I'm starting to think if I even should use a ORM because of the ORM I use (Hibernate) I also had to make several changes of the design to the worse just because the ORM doesn't support it (using the Null Object Pattern or Interface segregation principle, for example).

  • The additional information the 2nd project needs, if that's stored in the DB as well, you have your answer. If it's not stored in the DB, you can simply create new classes which reference the ones in the first project? Aug 13, 2014 at 8:44
  • @FransBouma The additional information is stored in the database but it's more like metadata which is only needed in the 2nd project.
    – Jimmy T.
    Aug 13, 2014 at 14:40


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.