I need help
how can i store objects
into two class .
public class Team{
List<Player> players;
}
public class Player{
List<Team> teams;
}
I have StackoverflowError
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I need help
how can i store objects
into two class .
public class Team{
List<Player> players;
}
public class Player{
List<Team> teams;
}
I have StackoverflowError
Hello,
do you have the full stack strace?
Thanks,
Olivier
i'm sorry i was not there.
i just come back
no, how i will do to get it?
thanks
public class Book{
private String title;
List categories;
public Book (String title){
this.title=title;
categories = new ArrayList();
}
public addCat(Category cat){
categories.add(cat);
}
}
public class Category{
private Strins catTyp;
List books;
public Category (String catTyp) {
this.catTyp = catTyp;
books = new ArrayList();
}
public addBook(Book book){
books.add(book);
}
}
private void setBookCategory(long bookId,long catId){
try {
List lBooks = new ArrayList();
List lCats = new ArrayList();
Book loadedBook = getBook(bookId); // retrieve a specific book of database
Category loadedCat = getCategory(catId);
lBooks.add(loadedBook);
for(Book pBook: loadedCat.getBooks()) lBooks.add(pBook);
lCats.add(loadedCat);
for(Category pCat: loadedBook.getCategories())lCats.add(pCat);
loadedCat.setBooks(lBooks);
loadedBook.setCategories(lCats);
// store object to the database
odb.store(loadedCat);
odb.store(loadedBook);
} catch(Exception e) {
if (odb != null) {
//odb.rollback();
}
}
}
i'm store 9 books but after 9 books i get a StackOverflowError
Salut olivier
dans le tutoriel1
le step 9 ne return rien. peux tu revoirs ca?
j'ai executer le fichier run tutorial.
in tutorial 1 the step 9 return null.