-->
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.  [ 2 posts ] 
Author Message
 Post subject: null index column for collection
PostPosted: Fri Nov 04, 2011 8:25 am 
Newbie

Joined: Fri Nov 04, 2011 4:00 am
Posts: 1
Hi!
I have a base class Activity and two classes inheriting it, MovementActivity and DurationActivity.
MovementActivity contains two ArrayLists, activitiesBefore and activitiesAfter, both containing DurationActivity.

private List<DurationActivity> activitiesBefore = new ArrayList<DurationActivity>();
private List<DurationActivity> activitiesAfter = new ArrayList<DurationActivity>();

The annotations are in MovementActivity:

@OneToMany(orphanRemoval = true)
@IndexColumn(name = "actBefore_idx", base = 0)
@JoinColumn(name = "movementActivity_id")
//@Where(clause="actBefore_idx != null")
@Cascade({org.hibernate.annotations.CascadeType.ALL})
public List<DurationActivity> getActivitiesBefore() {
return activitiesBefore;
}
resp.
@OneToMany(orphanRemoval = true)
@IndexColumn(name = "actAfter_idx", base = 0)
@JoinColumn(name = "movementActivity_id")
//@Where(clause="actAfter_idx != null")
@Cascade({org.hibernate.annotations.CascadeType.ALL})
public List<DurationActivity> getActivitiesAfter() {
return activitiesAfter;
}

The annotation in DurationActivity is:

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "movementActivity_id", insertable = false, updatable = false)
public MovementActivity getMovementActivity() {
return movementActivity;
}

A while ago I only had the first list and everything worked fine, but after the introduction of the second list
a exception is thrown:
org.hibernate.HibernateException: null index column for collection: MovementActivity.activitiesAfter
at the instant a list of parents (MovementActivity) is read from DB.
No effort to read any data has been made, just the single line:
List retList = query.list();

A DurationActivity object is created and stored i DB with actBefore_idx set to 0, and actAfter_idx set to null.
As you see above, I have tried with the where clause, and then the list comes up without exception,
but no child objects tied to the parent.

I want to be able to randomly insert objects in either of the lists, or none.

Is there a way to get pass this, with annotations?


Top
 Profile  
 
 Post subject: Re: null index column for collection
PostPosted: Sat Nov 05, 2011 5:33 am 
Newbie

Joined: Sat Nov 05, 2011 5:31 am
Posts: 1
Recesssed Lighting - frontline flea treatment - frontline combo

_________________
[url=http://www.petcomfortis.com]Frontline plus for cats[/url]-
[url=http://www.petcomfortis.com]Frontline plus for dogs[/url]-
[url=http://www.davincivaporizer.com/]Best vaporizer[/url]-


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