Named Parameters in Queries - the spec vs the Java EE 5 Tutorial
Hi,
I've been studying the topic about the named parameters in JPA and found one inconsistency between the spec and the Java EE 5 Tutorial. Could anyone lend me a helping hand understanding it?
The Java Persistence API spec (ejb-3_0-fr-spec-persistence.pdf) 3.6.3 "Named Parameters" at page 69 reads:
The use of named parameters applies to the Java Persistence query language, and is not defined for native queries.
whereas the Java EE 5 Tutorial in the section Named Parameters in Queries (http://java.sun.com/javaee/5/docs/tutorial/doc/PersistenceIntro3.html#wp81563) of The EntityManager reads:
Named parameters are case-sensitive, and may be used by both dynamic and static queries.
I think that the reality is that every JPA provider supports named parameters in dynamic and static queries, but it's not fully supported by the spec (yet not forbidden).
Jacek
Jacek Laskowski
http://www.jaceklaskowski.pl
Hi Jacek,
These are not conflicting statements. Named parameters apply to the Java Persistence
Query language only, not to native queries. There are two ways to specifiy
Java Persistence Query Language queries : dynamically and statically. You can
either pre-define the query string using @NamedQuery
static :
@NamedQuery(name="findPersonByName",
query="SELECT OBJECT(p) FROM Person p WHERE p.name LIKE :pName")
OR, pass the query string in at runtime using EntityManger.createQuery
dynamic :
em.createQuery("SELECT OBJECT(p) FROM Person p WHERE p.name LIKE :pName")
The dynamic approach allows you to construct portions of the query string at runtime.
My example doesn't do that but the point is that use of the createQuery()
API is considered the dynamic approach.
The crux of the Java EE 5 Tutorial statement you referenced is that named parameters apply to
both the static and dynamic use of Java Persistence Query Language queries.
--ken
Similar Messages
-
Chapter 29 is missing from "The Java EE 6 Tutorial, Volume II"
Chapter 29 is missing from "The Java EE 6 Tutorial, Volume II"
This is all that is available (on a single page):
Advanced Concepts in Java EE Security.
This chapter provides more information on securing applications.
Advanced Concepts in Java EE Security
After you have read the introductory chapters in Java EE Security, read this
chapter to learn more about using annotations
Anyone know where I can actually find the elusive Chapter 29?
Also, although Oracle recognizes that the document exists (https://www.sun.com/offers/details/java_ee6_tutorial.xml), you can no longer download it (+The offer you are looking for is no longer available.+).Got the solution, need to include /faces before the Login and Error page in the <login-config> entry as follows:
<login-config>
<auth-method>FORM</auth-method>
<realm-name>file</realm-name>
<form-login-config>
*<form-login-page>/faces/Login.xhtml</form-login-page>*
*<form-error-page>/faces/Error.xhtml</form-error-page>*
</form-login-config>
</login-config>
This configuration works fine with all the browsers including Internet Explorer. -
NullPoint Error shows up in The Java EE 7 Tutorial
I am reading The Java EE 7 Tutorial from http://docs.oracle.com/javaee/7/tutorial/doc/jsf-facelets005.htm#GIQZR
After I typed the example code in the chapter 8.5 Composite Components in my IDE and run the example on GlassFish4.0, I got an error.
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1078)
at com.sun.faces.util.Cache.get(Cache.java:116)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.getComponentMetadata(FaceletViewHandlingStrategy.java:237)
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:951)
at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:648)
Then I check the older version of this tutorial, I found a difference in email.xhtml code. The namespace has been changed from Java EE 7. After I changed the namespace back to JavaEE 6 version, it works.
Java EE 7
xmlns:composite="http://xmlns.jcp.org/jsf/composite"
Java EE 6
xmlns:composite="http://java.sun.com/jsf/composite"
Someone on the StackOverflow told me that this may caused by Glassfish has attempted to download a schema corresponding to one of those namespaces, and received a response that it can't handle. I don't know whether is the real root cause. Is there anyone has the same problem?The example from 30. august 2013 (tut-install/examples/web/jsf/compositecomponentexample/) is with the old namespace xmlns:composite="http://java.sun.com/jsf/composite"
But the namespace xmlns:composite="http://xmlns.jcp.org/jsf/composite" is also ok. Works with RI 2.2.4 on Tomcat. -
Could not run the bookstore1 example from the Java Web Services Tutorial
The bookstore1 servlets example from the Java Web Services Tutorial (issue Aug 1, 2002) was built and deployed successfully by using the deploytool (following the steps described on pages 498ff of the tutorial).
After deploying the application the Tomcat Web Application Manager shows the entry:
/bookstore1:stopped:0:D:\Programme\Java\tomcat\jakarta-tomcat-4.1.8\work\Standalone\localhost\manager\bookstore1.war
when entering the command: http://localhost:8080/manager/list.
After entering the command: http://localhost:8080/manager/start?path=/bookstore1, the (uncomplete) message appears:
FAIL - Application at context path /bookstore1 could not
It should be noted that I was able to build and deploy the application GSApp (chapter 3 of the tutorial) successfully.Did you set up the database as described in
http://java.sun.com/webservices/docs/1.0/tutorial/doc/WebApp13.html#69868 -
The Java Web Service Tutorial - help required
Using Windows 98 platform...
I am working through the tutorial example "Hello World". I have got as far as deploying the service definition and starting Tomcat.
The tutorial then says to specify the URL http://localhost:8080/jaxrpc-hello/jaxrpc to verify the HelloWorld service has been deployed. At this stage I get the message "The requested resource (/jaxrpc-hello/jaxrpc) is not available.
Every thing else looks right... has anyone got an idea?
SteveSrikanth,
The web.xml appears ok to me, I have pasted it below as I'm no expert.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<display-name>HelloWorldApplication</display-name>
<description>Hello World Application</description>
<servlet>
<servlet-name>JAXRPCEndpoint</servlet-name>
<display-name>JAXRPCEndpoint</display-name>
<description>Endpoint for Hello World Application</description>
<servlet-class>com.sun.xml.rpc.server.http.JAXRPCServlet</servlet-class>
<init-param>
<param-name>configuration.file</param-name>
<param-value>/WEB-INF/HelloWorld_Config.properties</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAXRPCEndpoint</servlet-name>
<url-pattern>/jaxrpc/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>
please let me know if there is an error.. or any more suggestions
Thanks,
Steve -
When editing a PL/SQL package I can type a package body name and "." and get a list of function/procedures to choose from. When I choose a function/procedure from the list I would like jdeveloper to dump out the function call complete with named parameters similar to the way it generates an anonymous block for you when you choose to run a function or procedure. How does one do this.
Thanks in advance.Hi,
the best way is to check this feature being avaiable in SQL Developer because JDeveloper 11 will consume their code base for the integrated PSLQL development environment. Let me know if you can't find it in there and I'll fiel an enhancement request against SQL Developer
Frank -
"The Java Web Services" - ant install
Hi, I recently downloaded "The Java Web Services" and "The Java Web Services Tutorial".
And I've reached the Creating the Build Properties File portion of the tutorial:
http://java.sun.com/webservices/docs/1.0/tutorial/doc/GettingStarted2.html#73059
I'm using Windows ME and I have no idea where to put the build.properties file.
Can anyone give me any suggestions? I am successfully able to
ant compile
but I can't get
ant install
to work once I have done the ant compile and I suspect this is because of me not having the build.properties file set... although it could be unrelated to that.
when I try to use:
ant install
I get the following error at the command prompt:
C:\tim\programs\jwsdp-1_0\docs\tutorial\examples\gs\build.xml:46: java.io.IOExce
ption: Server returned HTTP response code: 401 for URL: http://localhost:8080/ma
nager/install?path=%2Fgs&war=file%3AC%3A%5Ctim%5Cprograms%5Cjwsdp-1_0%2Fdocs%2Ft
utorial%2Fexamples%2Fgs%2Fbuild
Now tomcat is running on the correct port (8080) and the directory being referenced in the above URL exists. Am I supposed to map tomcat to a particular file system or something?
Thanks,
Tim
PS I have another post in this forum (it contains only my first question concerning the build.properties file), so if you would like the Duke dollars for both posts, feel free to post in both threads and if your answer helps me out, I'll give you the Dollars from both threads.Hi Tim
I have the same problem with the build.properties file. i am not able to solve the problem. did u find any solution for that problem u had. so plz let me knpow about that. i would appreciate if u could mail mne at [email protected]
thanks in ADV. -
Example code download for "The JavaTM Web Services Tutorial "
Web page at http://java.sun.com/webservices/docs/1.0/tutorial/doc/Preface.html#63740 describes the follwoing way to get code example
==========================================
If you are viewing this online, you need to download The Java Web Services Tutorial from:
http://java.sun.com/webservices/downloads/webservicestutorial.html
Once you have installed the tutorial bundle, the example source code is in the <JWSDP_HOME>/docs/tutorial/examples directory, with subdirectories for each of the technologies included in the pack.
==========================================
However, following the link, I download file jwsdp-1_5_01-tutorial.zip. But this zip does not contain a docs/tutorial/.. directory.
Any hint? Thanks in advance.Did you set up the database as described in
http://java.sun.com/webservices/docs/1.0/tutorial/doc/WebApp13.html#69868 -
Cannot complie the example at Java Web Services Tutorial 1.3,Ch3
Hi all,
At the Java Web Services Tutorial 1.3 Chapter 3, there has an example but I cannot compile!
The is the output of ant:
C:\jwsdp-1.3\jwstutorial13\examples\gs>ant build
Buildfile: build.xml
BUILD FAILED
file:C:/jwsdp-1.3/jwstutorial13/examples/common/targets.xml:1: taskdef class org.apache.catalina.ant.ListTask cannot be found
Total time: 5 seconds
Would you please give me an idea to solve this problem?
Thanks
ChrisOk...this is driving me nuts!!!
I am getting the same error (blah blah blah...ListTask cannot be found) and I have looked over the forum and copied over the catalina-ant.jar file into the apache-ant/lib dir. I have also included every path I can think of in the PATH env var and CLASSPATH env var...
PATH = C:\jwsdp-1.3\jwsdp-shared\bin;D:\pipeline\products\cygwin\bin;D:\Ant\apache-ant-1.5.4\bin;C:\jwsdp-1.3\apache-ant\bin;D:/pipeline/products/jdk;D:/lcms/products/jdk
pipeline is where my jdk (I have two different versions because two different apps) is and the ref to D:\Ant...is for another app.
CLASSPATH = C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar;C:\jwsdp-1.3\server\lib\catalina-ant.jar;C:\jwsdp-1.3\common\lib
ignore the XMLSpy stuff
please help...thanks ahead of time.
skye -
What are the parameters which control the pop up of sales area
Hi Experts
What are the parameters which control the pop up of sales area along with sales office when Sold to party is fed in to the CRM order .
I have an issue that, though the distribution channel and division is maintained in the sales org it is not appearing in the pop up.
The BP is extended to the sales area .
If any one can give me details / documentataion on the setting , it is highly appreciated.
Regards
RajDear Srikanth
Thank for your up date . in my case the customer is assigned with two sales area. The org model , nothing is maintained in the attributes , still one is appearing in the pop up and and other one is not . It is surpricing.
if you can mention the logic of maintaining the division and distribution channel inthe attribute it is of great help.
Regards
Raj -
Hey!
when starting my computer the screen is gray with two harddrives. One is named Macintosh HD and the other Recovery 10.9. My computer has never done this before! I am really worrid that my files will be lost if i choose to start the wrong harddrive. Which one should i choose? HELP!!You probably held down the Option or Command R keys when you heard the startup tone. Simply choose the HD. To learn what the Recovery partition is please read OS X: About OS X Recovery
-
Need help in modifying mapping parameters of out the box mapping
Hi There,
I am a new bee to dac.
Need help in modifying mapping parameters of out the box mapping, which is invoked by DAC task.
We got a requirement to edit mapping parameter. When I go and see parameter under mappings tab in a mapping, I could not see any values in it.
But when I set any value, and validate it. It is successful.
Is it right way to do it?
What my concern is, When I initially go and see parameter values under maapings tab in a mapping, they are blank.
Where is it storing these values?
Thanks,
RagIf you modify mapping then u have to create new task in dac and dac itself craete parameter file at run time. if you want to add more parameters then do it in dac system parameters tab.
Thanks
Jay. -
The parameters supplied for the batch are not valid.
Error:The parameters supplied for the batch are not valid
Stored Procedure is as follows
CREATE PROCEDURE [dbo].[Usp_TrackVehicleDetails]
@reg_Number NVARCHAR(25)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Imei_Number NVARCHAR(25),
@Imei_Table
NVARCHAR(MAX),
@Latitude_Val
NVARCHAR(MAX),
@Longitude_Val NVARCHAR(MAX),
@Imei_PK
NVARCHAR(MAX),
@result INT
-- Tracking Device by means of Latitude and Longitude
SELECT @Imei_Number=Imei_No FROM MapDevice_Vehicle WHERE Vehicle_No=@reg_Number;
SELECT @Imei_Table='Imei_'+@Imei_Number
SET @Imei_PK='SELECT(MAX(CAST(Imei_Id AS NVARCHAR(MAX)))) FROM dbo.'+@Imei_Table;
SET @Latitude_Val='SELECT Latitude FROM dbo.' +@Imei_Table+' WHERE CAST(Imei_Id AS NVARCHAR(MAX))='+'('+@Imei_PK+')';
SET @Longitude_Val='SELECT Longitude FROM dbo.' +@Imei_Table+' WHERE CAST(Imei_Id AS NVARCHAR(MAX))='+'('+@Imei_PK+')';
EXEC @result= sp_executesql @Imei_PK,@Latitude_Val,@Longitude_Val
SELECT @result
--RETURN @result
BEGIN TRY
BEGIN TRANSACTION T1
-- Returning Values based on Vehicle_Number
SELECT ISNULL(@Latitude_Val,'')[latitude],
ISNULL(@Longitude_Val,'')[longitude]
IF @@ERROR!=0
BEGIN
ROLLBACK TRANSACTION T1
END
ELSE
COMMIT TRANSACTION T1
END TRY
BEGIN CATCH
SELECT ERROR_MESSAGE() AS ErrMsg, ERROR_LINE() AS ErrLine,ERROR_PROCEDURE() AS ErrProc
END CATCH
ENDYour construct is not correct....
EXEC @result= sp_executesql @Imei_PK,@Latitude_Val,@Longitude_Val --These
should be parameters/....
Please try the below(The longitude and latitude to be included...)
/*Test script*/create table MapDevice_Vehicle(vehicle_no nvarchar(25),imei_no nvarchar(25))
Insert into MapDevice_Vehicle Select 'KL8P8234','KL'
create table Imei_KL(Imei_Id nvarchar(25))
Insert into Imei_KL Select 'KL8P8234'
exec [Usp_TrackVehicleDetails] 'KL8P8234'/*Test script*/
CREATE PROCEDURE [dbo].[Usp_TrackVehicleDetails]
@reg_Number NVARCHAR(25)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Imei_Number NVARCHAR(25),
@Imei_Table NVARCHAR(MAX),
@Latitude_Val NVARCHAR(MAX),
@Longitude_Val NVARCHAR(MAX),
@Imei_PK NVARCHAR(MAX),@paramdefs nvarchar(MAX),@result INT
-- Tracking Device by means of Latitude and Longitude
SELECT @Imei_Number=Imei_No FROM MapDevice_Vehicle WHERE Vehicle_No=@reg_Number;
SELECT @Imei_Table='Imei_'+@Imei_Number
SET @Imei_PK='SELECT(MAX(CAST(Imei_Id AS NVARCHAR(MAX)))) FROM dbo.+@Imei_Table';
SET @paramdefs = N'@Imei_Table nvarchar(255)';
--SET @Latitude_Val='SELECT Latitude FROM dbo.' +@Imei_Table+' WHERE CAST(Imei_Id AS NVARCHAR(MAX))='+'('+@Imei_PK+')';
--SET @Longitude_Val='SELECT Longitude FROM dbo.' +@Imei_Table+' WHERE CAST(Imei_Id AS NVARCHAR(MAX))='+'('+@Imei_PK+')';
EXEC @result= sp_executesql @Imei_PK,@paramdefs,@Imei_Table = @Imei_Table
SELECT @result
--RETURN @result
BEGIN TRY
BEGIN TRANSACTION T1
-- Returning Values based on Vehicle_Number
SELECT ISNULL(@Latitude_Val,'')[latitude],
ISNULL(@Longitude_Val,'')[longitude]
IF @@ERROR!=0
BEGIN
ROLLBACK TRANSACTION T1
END
ELSE
COMMIT TRANSACTION T1
END TRY
BEGIN CATCH
SELECT ERROR_MESSAGE() AS ErrMsg, ERROR_LINE() AS ErrLine,ERROR_PROCEDURE() AS ErrProc
END CATCH
END -
How can I change the ordering of the parameters listed under the Labview module?
Is there anyway to change the ordering of the parameters listed in the parameters table under the Labview module tab in TestStand? Each of these parameters printout in my report, but I need to change the ordering of the parameters in the report. Thanks.
Hi,
There is not a way to manually change the order of the parameter values in the Code Module Parameters Table, but there are a few options for configuring the report ordering of these parameter values.
Option 1: Use the Additional Results in the Properties tab to add a Custom Result. You can then save the parameter values to these custom results and order them they way you desire. This ordering will be reflected in the report.
Option 2: You could use a Post Action in the Properties tab to swap the parameter values that are saved to Locals.ResultList[0].AdditionalResults at run-time. This would require the use of a local variable to serve as a temporary placeholder for one of the values in order to successfully swap the values.
-Adri
Adri Kruger
National Instruments
LabVIEW Product Marketing -
JRE 1.6 update 13 install with runtime parameters attached to the install.
I am trying to install Java 6 update 13 with the below parameters attached to the development.properties file. Is it possible to have a installation string attached to the Java install to have this done automatically without having to manually add it from the Java control panel? Below is the parameter I would like to already be loaded and added to the JRE.
-Dsun.java2d.d3d=false
Thanks,
Edited by: palamus on Sep 16, 2009 3:47 PMSure it's possible, but whether you can do it depends on the capabilities of whatever you're using to do the install. I would wxpect that most Java-aware installers have this capability.
Maybe you are looking for
-
JDBC Receiver channel is not showing any payloads
Hello Experts, My interface is ABAP PROXY to JDBC i am facing a strange issue in ECC moni payload is succesful in PI moni also Payload is black colour flag but my Receiver JDBC channel is not showing any thing but it is in green colour (it is not sho
-
Two "Call Adapter" step in SXMB_MONI
Hello Experts, I have developed Sync interface WebService - PI - BAPI. However when message is failing due to error in mapping at response side, there are 2 "Call Adapter" steps in sxmb_moni got that message. First Call Adapter step is not in error s
-
Is 24" iMac really any good?
I know this is a vague question but hang with me. I am about to buy a 24" iMac and decided to look on these forums first to check if there are any problems with them. I have now read all sorts of horror stories regarding the screen (too bright/dead p
-
How to make niconfig.daq active?
I have a system using Win 95, Run Time Engine 5.1.1, Ni-Daq 6.1, and an executable application which worked previously until the customer uninstalled everything. Everything has been re-installed and all error messages eliminated. No particular orde
-
Photoshop CS5 installation issues with Yosemite OS on Mac
I have tried the Adobe install program and it does not work.