Hello everyone,
i have to develop a confluence macro for our buisness. The macro should display some customer data in relation to their installed products. That the reason why we use an external database (postgres).
We attempt to develop the macro with hibernate. We test to different ways:
Here we can read the hibernate.cfg.xml but we can not instatiate a configuration object because there are some library conflicts with confluence. And there are the problem that the configuration object can not read correctly the hibernate.cfg.xml close to the <mapping class="xxx.xxx.xxx.User">.
URL hibernateFileURL = ClassLoaderUtils.getResource("hibernate.cfg.xml", this.getClass()); Configuration configuration = new Configuration().configure(new File(hibernateFileURL.toURI())); SessionFactory sessionFactory = configuration.buildSessionFactory(); Session session = sessionFactory.openSession();
Here we try to instantiate the entitymanager and there are some problems because the entity manager can not find the required persitence.xml. The persistence.xml ist located under resources/META-INF/.., the normal location.
EntityManager entityManager = Persistence.createEntityManagerFactory("XX").createEntityManager();
So my question is: can i connect my confluence macro to an external database with hibernate or jpa? Or can i connect to the internal confluence database add some tables and work with these?
There is an valid general way to do something like this?
I use confluence ATLAS Version: 5.0.13, all dependencies are the actuals from maven.
I hope there are some helpful answers.
Greetz Jan Kueck
Community moderators have prevented the ability to post new answers.
The valid general way is called Active Objects, it's like Hibernate an ORM-mapper, but much simpler:
Regards
Steve
Thanks for the fast reply! Yeah, I worked a bit with AO but not very deep, I will learn to work with it.. But one question. Can I use AO for a connection to an external database, only for the connection to the confluence database or to use for both? Thanks! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think, you can use it for both scenarios...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.