Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
JavaJEEJPA
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=Java Persistence Query Language (JPQL)= JPQL is an extension of EJBQL, which was introduced as part of the EJB 2.0 specification. The query language allows you to write portable queries that work regardless of the underlying data store. Queries in JPQL are not like SQL queries. Where a SQL query deals with tables and columns, a JPQL query deals with objects and attributes. Keywords of JPQL are case-insensitve, entities, identifier, attributes are case-sensitive. Operators are: * OR * AND * <> * NOT * BETWEEN * LIKE * IN * EMPTY * IS NULL * WHERE ==Examples== Query q = em.createQuery(<QUERYSTRING>); Query q = em.createNamedQuery(<QUERYNAME>); // see @NamedQueries annotation List<Type> l = q.getResultList(); // Query Strings FROM Kategorien // Kategorien is the classname or entity name if the name attribute of the entity annotation is used SELECT k FROM Kategorien SELECT k FROM Kategorien ORDER BY name // name is attribute of class Kategorien SELECT k FROM Kategorien k WHERE k.id.kategorieId = 1006 // id is a composite key SELECT x FROM Magazine x WHERE x.y.z = 'abc' OR x.y IS NULL SELECT x FROM Magazine x, IN(x.articles) y WHERE y.author = 'Mister B' SELECT kadisId, productsOptionsValuesName FROM ballaballa.dbxt.ProductsOptionsValues p Query q = emXT.createQuery("SELECT MAX(pov.id.productsOptionsValuesId) + 1 FROM ballaballa.dbxt.ProductsOptionsValues pov"); Number newPovIdNumber = (Number)q.getSingleResult(); Query q = emXT.createQuery("DELETE pa FROM ballaballa.dbxt.Produktattribute pa WHERE pa.id.hauptartikelnummer < " + BallaballaProperties.getHandmadeProductsMinKadisID()); q.executeUpdate(); q = emXT.createNativeQuery("INSERT INTO xt_sport_boeckmann.produktattribute " + " (`hauptartikelnummer`, `bestand`, `farbe_id`, `groesse_id`, `variantennummer`, `sortier_position`, `veroeffentlichungsdatum`,`verfuegbar_ab`) SELECT `hauptartikelnummer`,`bestand`,`farbe_id`,`groesse_id`,`variantennummer`,`sortier_position`,`veroeffentlichungsdatum`,`verfuegbar_ab` FROM " + " sp_kadis_db.produktattribute"); q.executeUpdate();
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width