-->
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.  [ 3 posts ] 
Author Message
 Post subject: ElementCollection mapped to view cant be set readonly
PostPosted: Tue Jul 17, 2012 11:54 am 
Newbie

Joined: Tue Jul 17, 2012 11:52 am
Posts: 2
Check out the following piece of code

Code:
@ElementCollection
   @CollectionTable(
         name = "vw_product_discounts",
         joinColumns = { @JoinColumn(name = "product_id", insertable = false, updatable = false) })
   @Column(name = "discount", updatable = false, insertable = false)
   public List<BigDecimal> getDiscounts() {
      return discounts;
   }


How do i make this read-only, it still tries to delete from the view although it should not do that.

Error sql:
Code:
delete from vw_product_discounts where product_id=?


Top
 Profile  
 
 Post subject: Re: ElementCollection mapped to view cant be set readonly
PostPosted: Mon Aug 06, 2012 9:25 am 
Newbie

Joined: Mon Aug 06, 2012 9:17 am
Posts: 1
I ran into the same problem that the items of a collection (mapped as ElementCollection) are never read-only, neither after setting the read-only flag on the session nor on the query. Have you found a solution to this problem?


Top
 Profile  
 
 Post subject: Re: ElementCollection mapped to view cant be set readonly
PostPosted: Mon Aug 06, 2012 9:28 am 
Newbie

Joined: Tue Jul 17, 2012 11:52 am
Posts: 2
Nope, I ended up mapping the view to a separate object and using that object. Then i made a transient getter with the same name as the old one to return a list of BigDecimal's, to prevent me from having to change all the code


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

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.