1

i want to marshal following entity with Castor using static Marshall method. However as entity has references to itself so it starts looping and from 44 DB rows it builds me 100MB file if doesn't crash. @XmlTransient on properties didn't helped. ORM is eclipseLink, EJB 3 (ADF 11.1.2.1.0)

@Entity
@NamedQueries( { @NamedQuery(name = "MenuItems.findAll", query = "select o from MenuItems o") })
@Table(name = "MENU_ITEMS")
public class MenuItems implements Serializable {
   @Column(nullable = false, length = 4000)
   private String definition;
   @Column(nullable = false)
   private String description;
   @Column(name = "DISPLAY_SEQ")
   private BigDecimal displaySeq;
   @Column(length = 64)
   private String key;
   @Id
   @Column(name = "MIT_ID", nullable = false)
   private BigDecimal mitId;
   @Column(name = "MULTI_INSTANCEABLE", nullable = false, length = 1)
   private String multiInstanceable;
   @Column(length = 1)
   private String visible;
   @ManyToOne
   @JoinColumn(name = "MIT_ID_PARENT")
   @XmlTransient private MenuItems menuItems;
   @OneToMany(mappedBy = "menuItems")
   @XmlTransient private List<MenuItems> menuItemsList;
   @ManyToOne
   @JoinColumn(name = "MTP_CODE")
   private MenuItemTypes menuItemTypes;
CW_Vaidotas
  • 139
  • 1
  • 12
  • Have you tried using a different marshaller like jaxb or jibx? Or is it a case where you "have" to use castor only? Personally, I found jaxb best for my case after testing on castor, jaxb & jibx. – Rahul Thakur May 11 '12 at 09:20
  • Other marshallers also have this kind of issues with entites [link]http://stackoverflow.com/questions/7811771/is-it-possible-to-use-xmlinversereference-where-object-and-property-are-of-same Although my college claims it's possible to do with Castor defining mapping file, if so, i will post solution. – CW_Vaidotas May 12 '12 at 09:52
  • Yes, you should look into castor mapping, there may be something that is not taken care by annotations. [Check here](http://www.castor.org/xml-mapping.html) – Rahul Thakur May 14 '12 at 06:38

0 Answers0