Re: Error with nested class

Armin Waibel <[email protected]> Mon, 10 Sep 2007 14:05:11 +0200
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Hi Robert,

Robert Giddings wrote:
> Hi Armin,
> 
> Here is the code of the class and inner class in question.
> 
> Rob
> 
> package com.netcase.netspat.recordSystem.bo;
> 
> import com.netcase.bo.BaseObject;
> 
> public class Country extends BaseObject {
> 
...
> 	/*
> 	 * Nested
> 	 */
> 	
> 	/**
> 	 * @ojb.nested
> 	 * @ojb.modify-nested name="id"
>      *                    primarykey=""
> 	 */
> 	private CountryDateSet publicationDates;
> 	
...
> 	
> 	/*
> 	 * Constructors 
> 	 */
> 	
> 	public Country() {
> 		super();
> 	}
> 
...
> 	
> 	
> 	public class CountryDateSet extends BaseObject {
> 		
> 		/*
> 		 * Fields
> 		 */

OJB can't instantiate a non-static inner class. Declare CountryDateSet 
as static inner class - this should solve the problem (this is only 
possible if CountryDateSet doesn't use access to outer class Country 
members - I don't check this).

regards,
Armin