0

I am wondering if it is possible to map resources from an external project?

What I mean:

I have project A with hibernate.cfg.xml which will be communicating with JMS and added to buildpath project B, which has classes and HBM mappings for them.

I would like to create queries from project A, which will ask the database and return proper objects of classes defined in project B.

Any ideas how to achieve this?

A simple <mapping resource="/project/location_of_hbpm" /> in the config file doesn't work...

tkw83
  • 185
  • 1
  • 5
argh
  • 143
  • 4
  • 16
  • if the configuration file is in classpath then you will be able to access it. It is not required to be in same project. – Chaitanya Apr 28 '15 at 13:53
  • The project is in the classpath, I have even tried including it as jar file... The problem is that hibernate-config is in this firsrt project and it throws an error that unknown entity... – argh Apr 28 '15 at 14:02

1 Answers1

0

It is possible to map resources from external locations/projects as long as they are in CLASSPATH.

In your case, you can't because if you do, it would be a 'Circular Dependency' and it won't work.

Project B --> Depends on --> Project A (which has config/xml files). 

So you can't make

Project A --> Depend on --> Project B.

If you want to use the Project B 'POJO/Classes' in Project A, then try to extract those classes from 'Project B' into a separate JAR file and let both Project B and Project A depend on it.

K139
  • 3,654
  • 13
  • 17