Using SQL in Query in 3.0.0
I'm very happy to see this feature added to 3.0.0 along with methodQL. This
should alleviate a lot of the issues with trying to use only JDOQL,
especially when the desired SQL statemetn is well understood. Thanks for
adding this!
Ben
Marc,
Calling pm.flush() explicitly doesn't help. Calling
query.setIgnoreCache(true) does work, so that's good.
I even get the correct number of rows back in the Collection. Unfortunately
every item in the Collection is null. I definitely did a
query.setClass(DSChannelValueImpl.class) and it is enhanced properly,
because that's how the table got populated earlier in the test. I am doing a
SELECT *, so the class indicator and pk should be there. I'm assuming it
doesn't mind me aliasing the FROM table name, since I need to disambiguate
it to do a join (below).
Ben
"Marc Prud'hommeaux" <[email protected]> wrote in message
news:[email protected]...
Ben-
I've made a bug report for this:
http://bugzilla.solarmetric.com/show_bug.cgi?id=780
In the meantime, a nicer workaround will probably be to just call
setIgnoreCache(true) on the Query.
In article <[email protected]>, Marc Prud'hommeaux wrote:
Ben-
A potential (but, admittedly, not very nice) workaround for this for the
time being might be to enable NonTransactionalRead=true, and ensure that
there is not a transaction running at the time of query execution.
In article <[email protected]>, Patrick Linskey wrote:
Well, sounds like a bug. We'll take a look. Sorry about that.
What happens if you explicitly flush the PM before execution?
-Patrick
Ben Eng wrote:
Query query = pm.newQuery( "kodo.jdbc.SQL", null );
query.setClass( ChannelValue.class );
query.declareParameters( "VARCHAR pConn, DATETIME pStart,
DATETIME pEnd" );
String filter = "select * from dschannel as c" +
" left join channelsegment as s" +
" on c.pk = s.channel and" +
" c.supporting = pConn and" +
" (s.validForEnd > pStart or" +
" s.validForStart < pEnd)" +
" where s.channel is null";
query.setFilter( filter );
Collection resultSet = (Collection) this.query.execute(
connection, start, end );
This is being called from a method of a stateless session bean that is
only
performing this query. CMT, Required, and the client is not definingits own
transaction boundaries. Therefore, I would not expect anything to bedirtied
in this transaction. This is with the BEA WLS 7.0 appserver.
Ben
"Patrick Linskey" <[email protected]> wrote in message
news:[email protected]...
Ben,
Can you post the code that you're using to create the query?
-Patrick
Ben Eng wrote:
I just ran into a snag with this feature.
kodo.util.UnsupportedOptionException: kodo.jdbc.SQL language queries
cannot
be executed in-memory. Either set the javax.jdo.option.IgnoreCacheproperty
to true, set the kodo.FlushBeforeQueries property to true, or executethe
query before modifying objects within the transaction.
at
kodo.jdbc.query.SQLQuery.newInMemoryQueryExecutor(SQLQuery.java:117)
at kodo.query.AbstractQuery.internalCompile(AbstractQuery.java:545)
atkodo.query.AbstractQuery.getAccessPathMetaDatas(AbstractQuery.java:938)
>>>>
atkodo.query.AbstractQuery.isAccessPathDirty(AbstractQuery.java:745)
at kodo.query.AbstractQuery.executeWithMap(AbstractQuery.java:672)
at kodo.query.AbstractQuery.executeWithArray(AbstractQuery.java:640)
at kodo.query.AbstractQuery.execute(AbstractQuery.java:622)
at
com.metasolv.resources.queries.ChannelAvailabilityQueryBean.execute(ChannelA
>>>>
vailabilityQueryBean.java:84)
at
com.metasolv.oss.inventory.InventorySessionBean.queryInventory(InventorySess
>>>>
ionBean.java:1504)
Oddly, my ra.xml already has the following properties set.
<config-property>
<description>If false, then the JDO implementation mustconsider
modifications, deletions, and additions in the PersistenceManager
transaction cache when executing a query inside a transaction. Else,the
implementation is free to ignore the cache and execute the querydirectly
against the data store.</description>
<config-property-name>IgnoreCache</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
<config-property-value>true</config-property-value>
</config-property>
<config-property>
<description>Whether or not Kodo should automatically flush
modifications to the data store before executingqueries.</description>
>>>>>>
<config-property-name>FlushBeforeQueries</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>true</config-property-value>
</config-property>
I also tried explicitly calling ((KodoPersistenceManager)pm).flush()before
newQuery to no avail. I am at a loss how to get the Query to NOT
execute
in-memory.
Ben
"Ben Eng" <[email protected]> wrote in message
news:[email protected]...
I'm very happy to see this feature added to 3.0.0 along with
methodQL.
>>>>>>
This
should alleviate a lot of the issues with trying to use only JDOQL,
especially when the desired SQL statemetn is well understood. Thanks
for
adding this!--
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com
Similar Messages
-
I want to get all the documents based on content type using SQL Server Query. I know that, querying the content database without using API is not advisable, but still i want to perform this action through SQL Server Query. Can someone assist ?
You're right, it's not advisable, may result in corruption of your databases and might impact performance and stability. But assuming you're happy to do that then it is possible.
Before you go down that route, have you considered using something more safe like PowerShell? I've seen a script exactly like the one you describe and it would take far less time to do it through PS than it would through SQL. -
Using SQL as query type from the mapping workbench
Hi
We are upgrading a project from toplink 2.x to 9.03. The old used the java builder syntax for the finders, this is not supported anymore in 9.03. Therefore we need to convert these finders to either EBQL or SQL.
As our developers here mostly know standard SQL we'll like to use this. But in the toplink doc's we cant find any good examples how to use this. All the examples are also only with EBQL.
The questions is mostly how do you define the bind parameters in the SQL query string in the workbench.
select * from user where user.username = ?
select * from user where user.username = ?1
select * from user where user.username = #param1
select * from user where user.username = #param1#
select * from user where user.username = #1
select * from user where user.username = #1#
Any help?
/DenverWhat do you mean by "The old used the java builder syntax for the finders, this is not supported anymore in 9.03"?
TopLink still absolutely supports the Java builder syntax! In 9.03 we added Mapping Workbench support but just for EJBQL and SQL for that release -- you can still use the expression builder in code! In the upcoming 9.04 I've seen that you can use the builder syntax in the mapping workbench too!
- Don -
Invalid table name error when updating object in collection using SQL
Hi,
I have pl/sql code where I am selecting a object from a collection using sql select query. I am processing this record and now I want to update the collection with the new object. ie. ensure that the object that was fetched be removed and this new one be added.
considering my_ot is the object type and my_tt is the table type.
DECLARE
my_col my_tt;
my_col1 my_tt
my_var my_ot;
my_var2 VARCHAR2(10);
BEGIN
// populating my_col1 with select query
//populating my_col with select query
FOR my_col1.FIRST .. my_col.LAST LOOP
//populating my_var2
BEGIN
SELECT my_ot(c.field1, c.field2 ,c.field3) INTO my_var FROM TABLE(my_col) c WHERE c.field3 = my_var2
//processing the field my_VAR
UPDATE TABLE(my_col) c SET c.field1 = my_var.field1 , c.field2 = my_var.field2 , WHERE c.field3 = my_var.field3;
EXCEPTION WHEN NO_DATA_FOUND
my_col.EXTEND;
my_col(my_col.LAST) := // new my_ot object
END;
END LOOP;
Here, when compiling the update query is not being compiled. I am getting a error 'invalid table name'. Is there any way to modify an object in the collection without knowing its index?
If not, is it possible to find the index of a object in the collection in select query?
Thanks in advance
PaddyHi,
Is there any way to find the index of a object in the collection? Then I will simply replace the object at that index, right!
Thanks
Paddy -
How to view clob data using sql
Hi,
In our database, we have one table that is having one column of CLOB datatype but now i want to view the data using sql select query but it throws error: "Datatype not supported".
Could any one please let me know how to view the clob data using select query.
Oracle DB version : 10.2.0.3
Thanksh5.
use read procedure
PROCEDURE READ (
lobsrc IN BFILE|BLOB|CLOB ,
amount IN OUT BINARY_INTEGER,
offset IN INTEGER,
buffer OUT RAW|VARCHAR2 );
example Updating LOB by Using DBMS_LOB in PL/SQL
DECLARE
lobloc CLOB; -- serves as the LOB locator
text VARCHAR2(32767):='Resigned: 5 August 2000';
amount NUMBER ; -- amount to be written
offset INTEGER; -- where to start writing
BEGIN
SELECT resume INTO lobloc
FROM employees
WHERE employee_id = 405 FOR UPDATE;
offset := DBMS_LOB.GETLENGTH(lobloc) + 2;
amount := length(text);
DBMS_LOB.WRITE (lobloc, amount, offset, text );
text := ' Resigned: 30 September 2000';
SELECT resume INTO lobloc
FROM employees
WHERE employee_id = 170 FOR UPDATE;
amount := length(text);
DBMS_LOB.WRITEAPPEND(lobloc, amount, text);
COMMIT;
END; -
Use evdre to query data from a SQL View
Hi all
I believe that it is possible to use evdre to query data from a SQL View. If this is possible then how does one go about setting it up in the evdre options (assuming that the view has already been created)?
Regards,
ByronByron, perhaps this is no longer supported, it might be worth opening up a case at service.sap.com on this. However, I did find the following on Page 11 of the "Usages and Considerations of EVDRE" pdf file. This doc is imbedded in the helpfile for BPC 7 SP5 (which was released in August of 2009, well after note 1315011 was last updated.
It looks like you are limited to one custom view per application, since you have to name the view in a parameter at the APPLICATION level. Go into BPC Administration, login to the application related to the custom view, choose "Set Application Parameters" and enter the name of the view to the Application Parameter called "EVDRE_QUERYVIEWNAME" If it is not listed, go ahead and create it at the bottom of the Application parameter screen.
Also: I interpreted the following info from Page 10 of the same doc:
In your EVDRE, set the following options:
QueryEngine: MANUAL
QueryType: enter either NEXJ OR TUPLE see below:
NEXJ - Use two-dimensional queries using the nonemptycrossjoin function
TUPLE - Use two-dimensional queries using tuples"
And I'm assuming you'd enter a Y for the following two parameters:
QueryViewName
"..to enforce the query engine to use a used-defined SQL view of the fact tables, when trying to read the values using SQL queries. This option is typically used in conjunction with the SQLOnly option (see below). "
Option SQLOnly
"..to enforce the query engine to only execute SQL queries, when reading data. This can be achieved using this option." -
Retreving Hexadecimal Values from a table using SQL query.
Hi,
I'm looking for a query to retreive Hexadecimal values contained in a column using SQL query.
The column contains the values of all types, alphanumeric, numeric and hexadecimal.
I need to retreive only hexadecimal values.
any help to me in this regard will be appreciated.
ThanksPresumably, you can be sure that any valid hex value is indeed MEANT to BE a hex value. For example the value 'ACE' is meant to be a hexadecimal value and not the word.
-
How to get tax break up of TDS using SQL query ?
Hi all,
We are developing a TDS report using SQL query
Report will contain VendorCode,Date(ap inv date),Vendor name,
Bill value,TDS Amount,
Bill Value 100.000,
TDS (2%) - 2.000,
TDS Surcharge(10% on TDS) - 0.2,
TDS Cess(2%(TDS+TDS Surcharge)) - 0.044,
TDS HeCess(1%(TDS+TDS Surcharge)) - 0.022.
We have developed this report which displays upto
VendorCode,Date(ap inv date),Vendor name,
Bill value,TDS Amount.
How to show tax break up of TDS in SQL query ?
Thanks,
With regards,
Jeyakanthan.Hi gauraw,
Thank for your reply.
I modified the query , pasted the query
as below in query generator,
Select T0.DocNum,T0.DocDate,T0.CardCode as 'Ledger',T1.TaxbleAmnt As 'Bill value',T1.WTAmnt as 'TDSAmt',(TDSAmt * 0.1) as 'TDS_Surch',
(((TDSAmt0.1) + TDSAmt)0.02) as 'TDSCess',
(((TDSAmt0.1) + TDSAmt)0.01) as 'TDSHCess'
FROM OPCH T0 INNER JOIN PCH5 T1 ON T0.DocEntry = T1.AbsEntry
WHERE (T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]')
on clicking execute its showing error message invalid column
name 'TDSAmt'.
With regards,
Jeyakanthan -
Help Required -- Can we use SQL Query to READ data from SAP MDM Tables
Hi All,
Please help.........
Can we use SQL Query to READ(No Creation/Updation/Deletion just Read) Data from SAP MDM tables directly, without using MDM Syndicator.
Or direct SQL access to SAP MDM tables is not possible. Only through MDM Syndicator can we export data.
Thanks in Advance
RegardsAll the tables you create in Repository comes under A2i_CM_Tables in Database named as your repository name. So the tables names are fields of table A2i_CM_Tables. Now i tried it but cant make it.
Now, I dont think its possible to extract all fields in tables and there values using select query. May be pure sql guy can do that or not.
But there is no relation of data extraction and syndicator. Data is viewed in Data Manager. and you can also store data in a file from DM also.
BR,
Alok -
How to retrive the blob data from a table using sql query
Hi gurus,
I have a table which has " BLOB "content in a column .I want to view the data From BLOB column using sql query .It would be helpfull If some one share their idea.
Regards,
vardhani.You can use data templates.
See this: http://blogs.oracle.com/xmlpublisher/entry/blob_clob_raw_and_looooong
http://blogs.oracle.com/xmlpublisher/entry/inserting_blobs_into_your_repo
Thanks,
Bipuser -
How to use sql query in java ?
i don't know how to use sql query in java code.
who can give me some advice?
thankshttp://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/
-
How to get the query result of improvement (Before and After ) using sql de
how to get the query result of improvement (Before and After ) using sql developer.
Check
http://www.oracle.com/technetwork/articles/sql/exploring-sql-developer-1637307.html -
hi i am face with problem that is i want to show the how much approximate space required for backup or .bak file to get backup using sql query because i want to show the required memory for backup file on my java application
Hi FIROZ
TENNALI
Is this still an issue, or can we close the thread?
* closing a thread by marking the answer/s (there is a link beneath each response) and you can vote for useful responses as well (there is a link to vote on the left of each response)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
How to Use SQL Query having IN Clause With DB Adapter
Hi,
I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
Thanksinvoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter
-
Need to find the assets associated to a BCC project using SQL query
Hi,
Given a BCC project (project_id), I need to find the assets (type of asset, version, status etc) in that project using SQL queries.
I need this for reporting purpose and cannot do this programatically using any code.
Surprisingly ATG does not store this association in a direct way. Can someone provide me the query if you have already done this before?
I tried enabling loggingDebug in PublishingRepository and VersionManagerRepository to get the queries, but I did not get what I want.
Thanks in advance,
Gopinath RamasamyUPDATE:
When a project is selected in BCC, ATG is doing something crazy, as it appears to me, of querying all the tables (ofcourse when there is a cache miss) in all the versioned item descriptor with the workspace id of the project to display the assets contained in it.
I do not see an easy or direct way of coming up with a query for this requirement.
Please let me know if anyone has any other idea.
Thanks,
Gopinath Ramasamy
Maybe you are looking for
-
Help! My iPhone 4 displays a cord to an itunes icon and I can't get it to go away...even when plugged into my computer. My computer doesn't recognize it as a device. How can I just cancel all this and get my phone back to normal?
-
File not opening in Application Server
Hi All, I have generated csv file in application Server with the help of Open HUb Destination.In Open Hub 2 files will we generated(1 is structure of the file(s_ztest),2 is data file(ztest)).When i click on the structure of the file then it is openi
-
Netflix on tv from iMac?
my imac does not have a HDMI output port that I know of..... how do i connect to my samsung tv?
-
I received the message "No Sim Installed" when I turned on my iPad this morning. I tried resetting, but the "no Sim" message still appears in the upper left corner where AT&T usually appears.
-
I've read the thread about flaky wifi, but I think the following may be a different issue, as this is not purely wifi connectivity: I am using a year old MacBook Pro. It connects fine into my own wifi, and at friends' homes, hotels etc. However, it i