You have to pass a Person[] into the toArray() method...

Person[] array2 = ( Person[] )list.toArray( new Person[list.size()] );

-----Original Message-----
From: Andreas Bulling [mailto:[EMAIL PROTECTED] On Behalf Of
Andreas Bulling
Sent: Thursday, March 02, 2006 10:23 AM
To: Tapestry users
Subject: Re: Have domain entities to be serializable? How to insert
linebreaks in *.properties files?

On 02. Mär 2006 - 09:07:20, James Carman wrote:
| What error messages do you get on the query method?  Also, have you tried:
| 
| new ArrayList<Person>( getSession().createCriteria( Person.class ).list()
);

I've done some investigation in the meanwhile and now I know which
class cast causes the exception:

List<Person> list = _personDao.getPersons();
Object[] array = list.toArray();                <- works
Person[] array2 = (Person[]) list.toArray();    <- ClassCastException

But I don't know how to fix this... :(
JFYI: The Person entity is related to other classes by use of some
OneToMany and ManyToMany annotations. Perhaps this causes the problem?

Sincerly,
  Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to