Jump to content
JasperReports Library 7.0 is now available ×

Problem with getChildrenFolder?!


dabicht

Recommended Posts

Hello,

 

I extended RepoResource to implement my own kind of repository resources. From this resource I extend other resources. In this way I created a tree or resources that extend or have references from each other. That seems to work. But I get a problem when I try to do this:

 

I have a class X and a class Y. Y uses X. Y has a setX Method. I would like to set X to Y. I call setX on class Y and after that I call saveResource on the RepositoryService from jasper to save Y. Ok, that work. But only when I use a new X and new Y. But when I use a X from the repository that already exist, it doesn't work. I get the message "Resource X does no exist". And this message is wrong.

 

I used the debugger to find out why and it seems to me that the reason can be found in the class HibernateRepositoryService in the method getRepositoryReference.

 

The parameter owner in that case is my Y and res is my X. The problem is, that the method can't get a child folder from owner, and this causes, that repo stays null, that causes a exception.

 

Do I need additional configurations in my hibernate mappings? Is my configuration wrong? What is childrenFolder for?

 

Thanks in advance.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

A reference from one repository resource to another can be of two types:

A reference to a local/child resource. In this case, the referred resource is a child/component of the referring resource; this means that the referred resource is "local" to the parent so it is not tread as a stand-alone resource. Such local resources are automatically saved (to the children folder you were mentioning) when the parent resource is saved.

A reference to an external resource. In this case, the referred resource is independent of the referring resource and it has to exist when the referring resource gets saved.[/ol]

 

Depending on your requirements, you either have one type or both types of references from X to Y. I can't say more about how you should implement this without knowing what type of references you need to support.

 

HTH,

Lucian

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...