0

Just curious,What is the use of below imports in java.I'm wrongly imported while doing hibernate stuff and those are not compatible with hibernate.

import javax.management.Query;
import javax.management.QueryExp;

I gone through the api and found in that they can fire queries on the beans.

Can i use them on my hibernate pojo(to avoid some memory eat up)??or I understood in a wrong way ??

Any idea about them??

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307

2 Answers2

1

I gone through the api and found in that they can fire queries on the beans.

Not exactly. API Page states:

The MBean Server can be queried for MBeans that meet a particular condition, using its queryNames or queryMBeans method

So, it's not exactly about regular pojos. MBean or managed bean is one of the concepts introduced by Java Management Extensions (JMX) technology. As JMX Technology Overview states:

The Java objects that implement resources and their instrumentation are called managed beans, or MBeans. MBeans must follow the design patterns and interfaces defined in the JMX specification (JSR 3). This ensures that all MBeans provide the instrumentation of managed resources in a standardized way.

Basically MBeans are used to extend standard JVM management functionality. So, developers can integrate application-specific options to standard monitoring tools (jconsole) and, thus, simplify and standardize resource administration.

Query is just a utility class that introduce several methods used to build QueryExps. QueryExp objects are used to query MBeansServer.

Can i use them on my hibernate pojo(to avoid some memory eat up)?

Well, they aren't meant to be used that way. So, using them for such a purposes will just introduce confusion.

If you are looking for a way to query your pojos (I don't understand how does it help with memory eat up, though), check out these questions:

Community
  • 1
  • 1
default locale
  • 13,035
  • 13
  • 56
  • 62
1

They are part of the JMX Framework. I don't think using them without the framework would make sense.

Jonas Eicher
  • 1,413
  • 12
  • 18