• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate AND Axis2 problem

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I'm using detached hibernate pojos and Axis2 for exposing some data to webservices. I can't use Bidirectional mapping because when I serialize to Axis2 the xml goes in an eternal loop.

ex.

Customer Class with MarketToLanguage set
MarketToLanguage with reference to customer class

This ends up with an eternal loop when I try to serialize it to Axis. See this topic for more information


I have solved it by not using bidirectional mapping .

ex
I have a Customer, Market, And Language class, They are mapped together by A MarketToLanguage class.




Language and Markets looks pretty much the same. Here is the MarketToLanguage class


the mapping maps many-to-one in MarketToLanguage.hbm.xml for Language, Customer and Market.



I have done this so that I wont serialize the whole object graphs when exposing it as webservice. There are of course several other classes in this but I think you get the id�

First question: Any help on a better way of implementing Hibernate and Axis2?

Second question: When I delete a Customer I want all the MarketToLanguage that has that Customer to be deleted. I can't get this to work because there isn't any Set to add on-delete for in the Customer class since the Customer is unaware of the MarketToLanguage

How can I delete MarketToLanguages when I delete a Customer?

Hope you know what I meen
[ September 23, 2007: Message edited by: Mathias Nilsson ]
 
kostis tzanettis
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how did you manage to send back a list of objects from the service to your client. Your help would be greatfull
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use RPCServiceClient and just call the WebService

The returntype must be Object[].class. Or whatever object you are returning. You must use array and not List because axis only supports array. If you have implemented it as List use the List.toArray()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic