Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do embedded query using OQL in MAT Eclipse

Tags:

java

eclipse

oql

I can get all Thread objects by using query as below

SELECT OBJECTS dominators(s) FROM java.lang.Thread s

then if I want to do further analysis of the returned result objects, the OQL I think should be like below:

SELECT * from (SELECT OBJECTS dominators(s) FROM java.lang.Thread s)

But it turns to ClassCastException.

Problem reported: 
ClassCastException occured. Remember: sub queries with the modifier INSTANCESOF or INCLUDING SUBCLASSES must return only class objects 

java.lang.ClassCastException: org.eclipse.mat.parser.model.InstanceImpl cannot be cast to org.eclipse.mat.snapshot.model.IClass
    at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.doSubQuery(OQLQueryImpl.java:752)
    at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.internalExecute(OQLQueryImpl.java:642)
    at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.execute(OQLQueryImpl.java:627)
    at org.eclipse.mat.inspections.OQLQuery.execute(OQLQuery.java:50)
    at org.eclipse.mat.inspections.OQLQuery.execute(OQLQuery.java:1)
    at org.eclipse.mat.query.registry.ArgumentSet.execute(ArgumentSet.java:129)
    at org.eclipse.mat.ui.snapshot.panes.OQLPane$OQLJob.doRun(OQLPane.java:339)
    at org.eclipse.mat.ui.editor.AbstractPaneJob.run(AbstractPaneJob.java:34)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Does OQL in MAT Eclipse supports embedded query, and how can I get the results I want?

like image 461
Y.Huang Avatar asked Dec 31 '25 01:12

Y.Huang


1 Answers

It is a little bit tricky to make the sub-query work. Try following:

SELECT * from OBJECTS (SELECT OBJECTS dominators(s) FROM java.lang.Thread s)

I got the solution from below link: https://www.eclipse.org/forums/index.php/t/608746/

like image 98
painlet Avatar answered Jan 02 '26 14:01

painlet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!