-->
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.  [ 4 posts ] 
Author Message
 Post subject: Insert register when using a join between a Table and a View
PostPosted: Tue Feb 24, 2009 7:44 am 
Newbie

Joined: Tue Feb 24, 2009 7:26 am
Posts: 2
Hi all,

we are integrating with a bought product and we don't want to manage their tables on the database. For these reason and for performance, we are going to manage these data over views.
In our developments, we are creating new tables (i.e travel requests table) and we are doing a join with a view (i.e in the travel requests table we store the user ID and we've got all the user information on a view).
With this scenario, we've got an entity that includes a @OneToMany relationship between travel request and user information.
We don't have any problem to retrieve the data but when we try to insert a new register on the database (a new travel request), we receive an exception becasuse JPA is trying to modify the view (thing that we don't want to do, we only need to insert a new register into the travel requests table).
We are thinking about to create two different entityes, one for select statments with the join explained above and other one for insert / update statments only mapped to the travel requests table.
Is this the best way to do that? Is there any other better approach to do this?

Kind regards,

Ivan.-


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2009 7:57 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
specify the cascade for the table view relation with cascade="none"

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 8:03 am 
Newbie

Joined: Tue Feb 24, 2009 7:26 am
Posts: 2
littypreethkr wrote:
specify the cascade for the table view relation with cascade="none"


I'm using Spring + JPA 1 and this kind of Cascade type is not supported. The supported types are:ALL, MERGE, PERSIST, REFRESH and REMOVE.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 2:09 pm 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
Well I think that by default no operation is cascaded. So if you don't specify any cascade for the relation then it should be equivalent to cascade=none.

If tht doesn't work then try this
Code:
@OneToMany(cascade = {})

_________________
Regards,
Litty Preeth


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.