cyberborean / rdfbeans

Java persistence with RDF
Other
11 stars 12 forks source link

getAll() throws exception #32

Closed twallmey closed 5 years ago

twallmey commented 5 years ago

Hi all,

I'm using interfaces (not classes) while working with RDFBeans. When accessing my persisted beans via getAll() and trying to iterate the results I get the following exception:

Caused by: java.lang.NoSuchMethodException: () at java.lang.Class.getConstructor0(Class.java:3082) at java.lang.Class.newInstance(Class.java:412) ... 66 common frames omitted

As interfaces do not have an constructor I do understand the error, of course. But would except that some proxy magic is in place to enable the iteration. How can I make the iteration work? Here is the code I'm using:

public static void toList(CloseableIteration<? extends Individual, Exception> iter, List results) {
try {
while(iter.hasNext()) { Individual individual = iter.next(); results.add(individual); } }catch(Exception ex) { logger.error("Building result list from iterator.", ex); } }

twallmey commented 5 years ago

Hi all! Solved this issue on my own. I wasn't able to read the API. I'm now using createAll() instead of getAll() and everything is working as expected!