1 , basic query 1, non-conditional query 2. Query with conditions 3, through the parameters of the query 4. Query by named parameters 5. Querying empty elements 2 , common query 1. List query (in ()) 2. Projection Query 3, projection of an element query ( NOTE: You cannot use SELECT * to query ) 4. Other types of projection 5. Single element query (Uniqueresult) 6, paging query 3 , Object-based queries, and SQL Native Query There is also an object-based query in hibernate Queries can
HQL operation1. Distribute byDistribute by Col Scatter data across Col columns to different reduceSortSort by col sorts data according to Col columnSelect COL,CO2 from table_name distribute by col1 Sort by col1Asc,col2 desc;The combination of both ensures that the output of each reduce is orderlyApplication Scenarios:* The file size of map output is not uniform* Reduce output file size is not uniform* Too many small files* File size is very large2. Cl
1. the query result is part of the table field, not all
Ad is a couponad object
Coupon is an attribute of AD and also an entity class.
Select ad. Coupon from couponad ad where ad. Deleted = false order by createddate DESC
2. Like Fuzzy search
Here, the variable key is of the string type.
String hql = "from Coupon coupon where coupon.deleted=false and coupon.name like :key"; Map
3. Total number of queries
public int getTotalCou
An error is reported when Java applications are deployed in weblogic10.3.
Org. hibernate. queryexception: classnotfoundexception: org. hibernate. hql. Ast. hqltoken
Solution:
Go to the Weblogic installation directory and modify the parameter pre_classpath (in red) in the setdomainenv. Sh file)
[Root @ localhost bin] # cd/BEA/WebLogic/user_projects/domains/mydomain/bin[Root @ localhost bin] # lsNodemanager server_migration service_migration setdo
'foo', 69, '2017-01-01 10:00:01. 0'
Java public static final constants eg. Color. TABBY
I don't have to explain anything else. Here I just want to explain the parameters in the query:We know that when passing parameters in SQL for query, we usually use PreparedStatement to write a lot of "?" In the statement,This method can also be used in hql, for example:List mates = sess. find ("Select employee. name from Employee as employee" +"Where employee. Na
In WebLogic, you want to create a new domain to deploy a demo environment. However, when the new domain is started, an exception hibernate. hql. Ast. hqltoken is reported as soon as the project is accessed, and the service is terminated,
I checked it online.
Http://www.24xuexi.com/w/2011-05-03/89204.html
Two jar packages under Bea \ modules conflict with the jar (antlr-2.7.6.jar) package in the project to delete the jar package in weblogic10.3(CO
Dao --------------------------------------------------------------------------
/*** Return the required property value ** @ return returns a set */@ suppresswarnings ("unchecked") public list
------------------------------------------------------------------------- TestCode(Service layer omitted) Ignore )---------------------------------------------------------------------------------------------------------
// Some attributes are returned through h
I am not very familiar with the QBC syntax, but I would like to share it with you. Sometimes QBC is very efficient and it is very convenient to master it. I have already talked about some usage of QBC in my previous blog, today, we will review the query of the date range using QBC.CodeAs follows:
Methods In the DaO layer:
// Hql public list findbyhql (integer page, integer row, date startdate, date enddate) {try {query = session. createquery ("f
The main purpose is to try javacc and use the idea of compiling principles to construct your own language :)
First download javacc from your hometown of https://javacc.dev.java.net/javacc
Our goal today is to convert from teacher to select * from teacher
First, write the. JJ file.
1. Define the separator to be empty
SKIP:{""| "/T"| "/N"| "/R"| "/F"}
2. Define keywords. From is the hql keyword. Teacher is the class name entered by the user. It should b
Query object navigation. use. In hql for navigation.
The sample code is as follows:
/*** Object navigation Query*/Public ClassObjectnavquerytestExtendsTestcase {Public VoidTestquery1 (){Session session =Null;Try{Session = hibernateutils.Getsession();Session. begintransaction ();List students = session. createquery("Select S. name from student s where S. classes. name like '% 100 '"). List ();For(Iterator iter = students. iterator (); ITER. ha
Obviusly, criteria queries are more difficult to read if they get more complex-a good reason to prefer them for dynamic and programmatic query generation, but to use externalized hql and JPA Ql for predefined queries.
A proxy is initialized if you call any method that is not the identifier GetterMethod, a collection is initialized if you start iterating through its elements or ifYou call any of the collection-management operations, such as size (
The HQL statement is roughly as follows
Select T, case when t.targettype=0 then
(select A.name from Marketapp a where a.id = T.target)
Else "end
JSP reported the following error
Java.lang.NullPointerException at Org.hibernate.hql.internal.ast.tree.CaseNode.getDataType (casenode.java:39) A T Org.hibernate.hql.internal.ast.tree.SelectClause.initializeExplicitSelectClause (selectclause.java:152) at Org.hibernate.hql.internal.ast.HqlSqlWalk
First of all, the database is stored in the date (including time) now want to get a day of all the records in a field and then we need to query the record of a day
Pass the string, and then handle the string day in the form of "2012-01-01" if the return value is null, set to 0.
@Resource
private sessionfactory sessionfactory;
Public Double Getmoneyinofday (String day) {
string start = day+ "00:00:00";
String end = day+ "23:59:59";
String h
The following are 3 ways to implement fuzzy queries with Hibernate hql (object-oriented query language), in which one is the most ideal way in these three ways, at least the way one can effectively prevent the query bar The increase in the number of parameters required in the part of the code is too long to cause the code to line up the situation (too long code will cause later maintenance and testing of great inconvenience). But there is a better way
We learn hibernate query is to know HQL support condition query, divided into many aspects, here we have a specific hibernate query with examples to explain, hope to help the reader's study.
1. Support string method parameter pass query:
Example:
List students = session.createQuery("select s.id,s.name from Student s where s.name like '%1' ").list(); for (Iterator iter=students.iterator(); iter.hasNext();) { Object[] o
There's a friend in the group. To solve a problem, high score for a HQL multiple query statement.
For a description of the problem, see http://topic.csdn.net/u/20090621/16/4eac6fe0-bf3e-422e-a697-f7584732f66e.html, as follows:
A discipline table (Field), a user table (users), many-to-many relationships.
Subject table has two fields, ID and Descripiton, User table has many fields, not listed
Set set in field with users
Set set fields in user
Now
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.