Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LazyLoading bug for SPARQL based Attributes #285

Closed
luxbe opened this issue Nov 20, 2024 · 0 comments · Fixed by #286
Closed

LazyLoading bug for SPARQL based Attributes #285

luxbe opened this issue Nov 20, 2024 · 0 comments · Fixed by #286
Labels
Milestone

Comments

@luxbe
Copy link
Contributor

luxbe commented Nov 20, 2024

If the @sparql annotation is used to define an attribute that can be lazily resolved with a SPARQL query, JOPA throws an exception:

@Sparql(
    query = "SELECT ?capacity WHERE { ?x a <http://uob.iodt.ibm.com/univ-bench-dl.owl#Course> . ?x <http://uob.iodt.ibm.com/univ-bench-dl.owl#capacity> ?capacity }",
    fetchType = FetchType.LAZY
)
private Collection<Integer> allCapacity;
Exception in thread "main" java.lang.ClassCastException: class cz.cvut.kbss.jopa.model.metamodel.PluralQueryAttributeImpl cannot be cast to class cz.cvut.kbss.jopa.model.metamodel.PluralAttribute (cz.cvut.kbss.jopa.model.metamodel.PluralQueryAttributeImpl and cz.cvut.kbss.jopa.model.metamodel.PluralAttribute are in unnamed module of loader 'app')
	at cz.cvut.kbss.jopa.proxy.lazy.LazyLoadingProxyFactory.createProxy(LazyLoadingProxyFactory.java:62)
	at cz.cvut.kbss.jopa.sessions.CloneBuilder.populateAttributes(CloneBuilder.java:168)
	at cz.cvut.kbss.jopa.sessions.CloneBuilder.buildCloneImpl(CloneBuilder.java:136)
	at cz.cvut.kbss.jopa.sessions.CloneBuilder.buildClone(CloneBuilder.java:83)
	at cz.cvut.kbss.jopa.sessions.AbstractUnitOfWork.registerExistingObject(AbstractUnitOfWork.java:457)
	at cz.cvut.kbss.jopa.sessions.AbstractUnitOfWork.readObjectInternal(AbstractUnitOfWork.java:288)
	at cz.cvut.kbss.jopa.sessions.AbstractUnitOfWork.readObject(AbstractUnitOfWork.java:272)
	at cz.cvut.kbss.jopa.model.EntityManagerImpl.find(EntityManagerImpl.java:296)
	at cz.cvut.kbss.jopa.model.EntityManagerImpl.find(EntityManagerImpl.java:281)
	at cz.cvut.kbss.jopa.example01.ManualRunner.execute(ManualRunner.java:73)
	at cz.cvut.kbss.jopa.example01.ManualRunner.run(ManualRunner.java:57)
	at cz.cvut.kbss.jopa.example01.Example.main(Example.java:45)
luxbe added a commit to luxbe/jopa that referenced this issue Nov 20, 2024
luxbe added a commit to luxbe/jopa that referenced this issue Nov 20, 2024
luxbe added a commit to luxbe/jopa that referenced this issue Nov 21, 2024
luxbe added a commit to luxbe/jopa that referenced this issue Nov 21, 2024
luxbe added a commit to luxbe/jopa that referenced this issue Nov 21, 2024
@ledsoft ledsoft linked a pull request Nov 21, 2024 that will close this issue
luxbe added a commit to luxbe/jopa that referenced this issue Nov 22, 2024
luxbe added a commit to luxbe/jopa that referenced this issue Nov 22, 2024
luxbe added a commit to luxbe/jopa that referenced this issue Nov 22, 2024
ledsoft pushed a commit that referenced this issue Nov 22, 2024
@ledsoft ledsoft added this to the 2.2.0 milestone Nov 22, 2024
@ledsoft ledsoft closed this as completed Nov 22, 2024
@ledsoft ledsoft added the bug label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants