Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Managing a Session Manually

Georg Schmidl October 18, 2011

When implementing the example code for "Managing a Session Manually" described at

https://developer.atlassian.com/display/CONFDEV/Hibernate+Sessions+and+Transaction+Management+Guidelines

I get the following exception:

caused by: java.lang.ClassNotFoundException: org.springframework.orm.hibernate.HibernateCallback
    at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
Georg Schmidl October 24, 2011

Ok I found out that the org.springframework.orm.hibernate package is not available, so this is impossible.

https://jira.atlassian.com/browse/CONF-18165

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 25, 2011

There's an example implementation at the bottom of this page: https://developer.atlassian.com/display/CONFDEV/RPC+Module

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 25, 2011

Ah, that really sucks.

Actually... there is a section on doco that you linked that specifically discusses what to do in plugins. You should be able to use com.atlassian.sal.api.transaction.TransactionCallback; and com.atlassian.sal.api.transaction.TransactionTemplate; to manage a hibernate session without interacting with any of the hibernate classes directly.

Georg Schmidl October 27, 2011

That worked. Thanks!

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 30, 2011

Awesome! Sorry I didn't point this out straight away and sent you on a goose chase with your plugin's bundle intructions. :-)

0 votes
Scott Selberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 6, 2015

So, I found these instructions a bit incomplete.  in my atlassian-plugin.xml file I needed to add the following before Spring could import the object:

<component-import key="transactionTemplate" name="Hibernate Transaction Template" interface="com.atlassian.sal.api.transaction.TransactionTemplate" />

 

After that, I could use the normal mechanism to pull the object in via the class constructor.

0 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 19, 2011

If your atlassian-plugin.xml has an <Import-Package> element, make sure that you are importing the org.springframework.orm.hibernate namespace.

Georg Schmidl October 19, 2011

I've added

&lt;Import-Package&gt;org.springframework.orm.hibernate,*;resolution:=optional&lt;/Import-Package&gt;

to my plugin and now I'm getting this at installation:

Caused by: org.osgi.framework.BundleException: [...] Unable to resolve 89.0: missing requirement [89.0] package; (package=org.springframework.orm.hibernate)

TAGS
AUG Leaders

Atlassian Community Events