-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Polymorphism the other way round
PostPosted: Tue Nov 18, 2008 12:20 pm 
Newbie

Joined: Tue Nov 18, 2008 12:10 pm
Posts: 2
Hello,

I am using Hibernate with JPA via Annotations. My Entities have an inherance strategy. So B extends A.

Then I have a class C which holds a List of As.

Code:
@OneToMany(cascade = CascadeType.ALL)
private List<A> as= new ArrayList<A>();


If I want to persist my C with a List of As (where also Bs can be placed) via
Code:
getJpaTemplate().persist(C);
the cascade mechanism works, but it only saves As.

I read in the Hibernate Docu about PolymorphismType? But as it seems it is only for reading entities.
Is there something for writting entities to get rid of my problem?

Thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.