Query: Missing tablename in generated SQL for vertical mapped classes
Hi,
I am playing with Kodo 3.1.4 / Postgres 7.4 and could not find any
solution for this problem:
I have one class calles "Clipfragment" which represents video clips and
has a long - field named "lengthInMinutes". It extends a baseclass
called "Categorizablefragment", which has a field "id" and some others.
I use vertical mapping, thus having one table per class. The identity
type is 'application'. The table for the class "Categorizablefragment"
contains fields for jdoclass and jdoversion and IMHO correct entries.
Everything works really fine except for Querys against subclass fields
with aggregate functions. E.g. counting all clips works:
KodoQuery q = (KodoQuery) getJdoPm().newQuery(ClipFragment.class);
q.setResult ("count(id)");
Number count = (Number) q.execute ();
But: Querying for the sum of the field 'lengthInMinutes' fails:
KodoQuery q = (KodoQuery) getJdoPm().newQuery(ClipFragment.class);
q.setResult ("sum(lengthInMinutes)");
Number count = (Number) q.execute ();
The exception is:
kodo.util.UserException: com.solarmetric.jdbc.ReportingSQLException:
ERROR: syntax error at or near "WHERE"
{prepstmnt 16398807 SELECT AVG(t0.lengthinminutes) FROM WHERE
t1.jdoclass = ? [reused=0]} [code=0, state=42601]
NestedThrowables:
com.solarmetric.jdbc.ReportingSQLException: ERROR: syntax error at or
near "WHERE"
{prepstmnt 16398807 SELECT AVG(t0.lengthinminutes) FROM WHERE
t1.jdoclass = ? [reused=0]} [code=0, state=42601]
at kodo.query.AbstractQuery.executeWithMap(AbstractQuery.java:865)
at kodo.query.AbstractQuery.execute(AbstractQuery.java:728)
atde.jk.buvas.model.impl.DefaultClipManager.getTotalTime(DefaultClipManager.java:43)
And the SQL - Trace:
5766 TRACE [main] kodo.jdbc.SQL - <t 17089909, conn 31908613 (1
errors)> [0 ms] executing prepstmnt 17226426 SELECT
SUM(t0.lengthinminutes) FROM WHERE t1.jdoclass = ? [params=(String)
de.jk.buvas.model.fragments.ClipFragment] [reused=0]
I tried both 'base-tables' and 'per-subclass' for the property
kodo.jdbc.VerticalQueryMode, without any results.
Any ideas?
Thanks,
Jochen
Hi Stephen,
here are the excerpts from the .jdo and the .mapping files. The .jdo
file was generated by XDoclet.
..jdo
<class name="ClipFragment"
identity-type="application"
objectid-class="CategorizableFragment$Id"
persistence-capable-superclass="CategorizableFragment"
> <!-- end class tag -->
<extension vendor-name="kodo"
key="jdbc-class-map-name"
value="vertical">
<extension vendor-name="kodo" key="table" value="Clip"/>
</extension>
<field name="title"
> <!-- end field tag -->
<extension vendor-name="kodo"
key="jdbc-size"
value="100">
</extension>
</field>
<field name="lengthInMinutes"
> <!-- end field tag -->
</field>
<field name="description"
> <!-- end field tag -->
<extension vendor-name="kodo"
key="jdbc-size"
value="3000">
</extension>
</field>
<field name="recordingDate"
> <!-- end field tag -->
</field>
<field name="actors"
> <!-- end field tag -->
<collection
element-type="de.jk.buvas.model.fragments.ActorFragment"
> <!-- end collection tag -->
</collection>
<extension vendor-name="kodo"
key="jdbc-element-delete-action"
value="exception-deferred">
</extension>
<extension vendor-name="kodo"
key="inverse-owner"
value="clips">
</extension>
</field>
<field name="media"
> <!-- end field tag -->
<collection
element-type="de.jk.buvas.model.fragments.MediumFragment"
> <!-- end collection tag -->
</collection>
<extension vendor-name="kodo"
key="jdbc-element-delete-action"
value="exception-deferred">
</extension>
</field>
</class>
<class name="CategorizableFragment"
identity-type="application"
objectid-class="CategorizableFragment$Id"
> <!-- end class tag -->
<extension vendor-name="kodo"
key="jdbc-class-map-name"
value="base">
<extension vendor-name="kodo" key="table" value="Categorizable"/>
</extension>
<field name="id"
primary-key="true"
> <!-- end field tag -->
</field>
<field name="category"
> <!-- end field tag -->
<extension vendor-name="kodo"
key="jdbc-delete-action"
value="exception-deferred">
</extension>
</field>
</class>
..mapping
<class name="ClipFragment">
<jdbc-class-map type="vertical" ref-column.ID="ID" table="CLIPFRAGMENT"/>
<field name="actors">
<jdbc-field-map type="many-many" element-column.ID="ID"
ref-column.ID="CLIPS_ID" table="ACTOR_CLIPS"/>
</field>
<field name="description">
<jdbc-field-map type="value" column="DESCRIPTION"/>
</field>
<field name="lengthInMinutes">
<jdbc-field-map type="value" column="LENGTHINMINUTES"/>
</field>
<field name="media">
<jdbc-field-map type="many-many" element-column.ID="MEDIA_ID"
order-column="MEDIA_ORDER" ref-column.ID="ID" table="CLIPF_MEDIA"/>
</field>
<field name="recordingDate">
<jdbc-field-map type="value" column="RECORDINGDATE"/>
</field>
<field name="title">
<jdbc-field-map type="value" column="TITLE"/>
</field>
</class>
<class name="CategorizableFragment">
<jdbc-class-map type="base" table="CATEGORIZABLEFRAGMENT"/>
<jdbc-version-ind type="version-number" column="JDOVERSION"/>
<jdbc-class-ind type="in-class-name" column="JDOCLASS"/>
<field name="category">
<jdbc-field-map type="one-one" column.ID="CATEGORY_ID"/>
</field>
<field name="id">
<jdbc-field-map type="value" column="ID"/>
</field>
</class>
Thanks,
Jochen
Stephen Kim wrote:
Can you post the mapping/metadata files for the two classes?
Jochen Kressin wrote:
Hi,
I am playing with Kodo 3.1.4 / Postgres 7.4 and could not find any
solution for this problem:
I have one class calles "Clipfragment" which represents video clips
and has a long - field named "lengthInMinutes". It extends a baseclass
called "Categorizablefragment", which has a field "id" and some
others. I use vertical mapping, thus having one table per class. The
identity type is 'application'. The table for the class
"Categorizablefragment" contains fields for jdoclass and jdoversion
and IMHO correct entries.
Everything works really fine except for Querys against subclass fields
with aggregate functions. E.g. counting all clips works:
KodoQuery q = (KodoQuery) getJdoPm().newQuery(ClipFragment.class);
q.setResult ("count(id)");
Number count = (Number) q.execute ();
But: Querying for the sum of the field 'lengthInMinutes' fails:
KodoQuery q = (KodoQuery) getJdoPm().newQuery(ClipFragment.class);
q.setResult ("sum(lengthInMinutes)");
Number count = (Number) q.execute ();
The exception is:
kodo.util.UserException: com.solarmetric.jdbc.ReportingSQLException:
ERROR: syntax error at or near "WHERE"
{prepstmnt 16398807 SELECT AVG(t0.lengthinminutes) FROM WHERE
t1.jdoclass = ? [reused=0]} [code=0, state=42601]
NestedThrowables:
com.solarmetric.jdbc.ReportingSQLException: ERROR: syntax error at or
near "WHERE"
{prepstmnt 16398807 SELECT AVG(t0.lengthinminutes) FROM WHERE
t1.jdoclass = ? [reused=0]} [code=0, state=42601]
at kodo.query.AbstractQuery.executeWithMap(AbstractQuery.java:865)
at kodo.query.AbstractQuery.execute(AbstractQuery.java:728)
atde.jk.buvas.model.impl.DefaultClipManager.getTotalTime(DefaultClipManager.java:43)
And the SQL - Trace:
5766 TRACE [main] kodo.jdbc.SQL - <t 17089909, conn 31908613 (1
errors)> [0 ms] executing prepstmnt 17226426 SELECT
SUM(t0.lengthinminutes) FROM WHERE t1.jdoclass = ? [params=(String)
de.jk.buvas.model.fragments.ClipFragment] [reused=0]
I tried both 'base-tables' and 'per-subclass' for the property
kodo.jdbc.VerticalQueryMode, without any results.
Any ideas?
Thanks,
Jochen
Similar Messages
-
Internal Error - Unable to generate SQL for this Scheduled Workbook
I am encountering the following error when loading the results of a Scheduled Workbook;
Internal Error - Unable to generate SQL for this Scheduled Workbook (If you scheduled this workbook using a previous version of Discoverer, please reschedule and re-open)
This only happens for one of the scheduled workbooks and I am struggling to find an explanation to the problem. There are no reference to database links in the workbook so I can rule that out as a cause.
Does anyone have any suggestions to what might be causing the problem?
Many thanks
StewartHi,
The version is OracleBI Discoverer Plus Version 10.1.2.48.18. Do you think this has anything to do with it?If you are on this version, then you have the recommended patches applied.
Did you try to reschedule the workbook and see if this helps in resolving the issue?
I would suggest you enable server logging as this may help in collecting more details about the error.
Note: 403689.1 - How To Generate Discoverer 10g (10.1.2) Session Server Logs In Text Format
https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=403689.1
Regards,
Hussein -
ORA-01489 Received Generating SQL for Report Region
I am new to Apex and I am running into an issue with an report region I am puzzled by. Just a foreword, I'm sure this hack solution will get a good share of facepalms and chuckles from those with far more experience. I welcome suggestions and criticism that are helpful and edifying!
I am on Apex 4.0.2.00.07 running on 10g, I believe R2.
A little background, my customer has asked an Excel spreadsheet be converted into a database application. As part of the transition they would like an export from the database that is in the same format as the current spreadsheet. Because the column count in this export is dynmic based on the number of records in a specific table, I decided to create a temporary table for the export. The column names in this temp table are based on a "name" column from the same data table so I end up with columns named 'REC_NAME A', 'REC_NAME B', etc. (e.g. Alpha Record, Papa Record, Echo Record, X-Ray Record). The column count is currently ~350 for the spreadsheet version.
Because the column count is so large and the column names are dynamic I've run into a host of challenges and errors creating this export. I am a contractor in a corporate environmentm, so making changes to the apex environment or installation is beyond my influence and really beyond what could be justified by this single requirement for this project. I have tried procedures and apex plug-ins for generating the file however the UTL_FILE package is not available to me. I am currently generating the SQL for the query in a function and returning it to the report region in a single column (the user will be doing a text-to-column conversion later). The data is successfully being generated, however, the sql for the headers is where I am stumped.
At first I thought it was because I returned both queries as one and they were joined with a 'union all'. However, after looking closer, the SQL being returned for the headers is about +10K+ characters long. The SQL being returned for the data is about +14k+. As mentioned above, the data is being generated and exported, however when I generate the SQL for the headers I am receiving a report error with "ORA-01489: result of string concatenation is too long" in the file. I am puzzled why a shorter string is generating this message. I took the function from both pages and ran them in a SQL command prompt and both return their string values without errors.
I'm hopeful that it's something obvious and noobish that I'm overlooking.
here is the code:
data SQL function:
declare
l_tbl varchar2(20);
l_ret varchar2(32767);
l_c number := 0;
l_dlim varchar2(3) := '''|''';
begin
l_tbl := 'EXPORT_STEP';
l_ret := 'select ';
for rec in (select column_name from user_tab_columns where table_name = l_tbl order by column_id)
loop
if l_c = 1 then
l_ret := l_ret || '||' || l_dlim || '|| to_char("'||rec.column_name||'")';
else
l_c := 1;
l_ret := l_ret || ' to_char("' || rec.column_name || '")';
end if;
end loop;
l_ret := l_ret || ' from ' || l_tbl;
dbms_output.put_line(l_ret);
end;header sql function:
declare
l_tbl varchar2(20);
l_ret varchar2(32767);
l_c number := 0;
l_dlim varchar2(3) := '''|''';
begin
l_tbl := 'EXPORT_STEP';
for rec in (select column_name from user_tab_columns where table_name = l_tbl order by column_id)
loop
if l_c = 1 then
l_ret := l_ret || '||' || l_dlim || '||'''||rec.column_name||'''';
else
l_c := 1;
l_ret := l_ret || '''' || rec.column_name || '''';
end if;
end loop;
l_ret := l_ret || ' from dual';
dbms_output.put_line(l_ret);
end;-------
EDIT: just a comment on the complexity of this export, each record in the back-end table adds 12 columns to my export table. Those 12 columns are coming from 5 different tables and are the product of a set of functions calculating or looking up their values. This is export is really a pivot table based on the records in another table.
Edited by: nimda xinu on Mar 8, 2013 1:28 PMThank you, Denes, for looking into my issue. I appreciate your time!
It is unfortunately a business requirement. My customer has required that the data we are migrating to this app from a spreadsheet be exported in the same format, albeit temporarily. I still must meet the requirement. I'm working around the 350 columns by dumping everything into a single column, which is working for the data, however, the headers export is throwing the 01489 error. I did run into the error you posted in your reply. I attempted to work around it with the clob type but eneded up running into my string concatentation error again.
I'm open to any suggestions at this point given that I have the data. I'm so close because the data is exporting, but because the columns are dynamic, the export does me little good without the headers to go along with it. -
View the generated sql for fetching a repository item
Hi guys.
I am interested in viewing the sql that ATG framework generates to fetch a primary repository item. I would like to use this generated sql, directly on the database and avoid me the pain of having to join multiple tables to get one repository item, basically looking to avoid having to write complex sql queries to fetch information for a repository item as ATG application would view it.
I know there is a switch somewhere to turn it on, but an example would be great. Thanks!Turn on the logging debug on for the repository.
Peace
Shaik -
Entity Framework Generated SQL for paging or using Linq skip take causes full table scans.
The slq genreated creates queries that cause a full table scan for pagination. Is there any way to fix this?
I am using
ODP.NET ODTwithODAC1120320_32bit
ASP.NET 4.5
EF 5
Oracle 11gR2
This table has 2 million records. The further into the records you page the longer it takes.
LINQ
var cnt = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
select errorLog).Count();
var query = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
orderby errorLog.ERR_LOG_ID
select errorLog).Skip(cnt-10).Take(10).ToList();
Here is the query & execution plans.
SELECT *
FROM (SELECT "Extent1"."ERR_LOG_ID" AS "ERR_LOG_ID",
"Extent1"."SRV_LOG_ID" AS "SRV_LOG_ID",
"Extent1"."TS" AS "TS",
"Extent1"."MSG" AS "MSG",
"Extent1"."STACK_TRACE" AS "STACK_TRACE",
"Extent1"."MTD_NM" AS "MTD_NM",
"Extent1"."PRM" AS "PRM",
"Extent1"."INSN_ID" AS "INSN_ID",
"Extent1"."TS_1" AS "TS_1",
"Extent1"."LOG_ETRY" AS "LOG_ETRY"
FROM (SELECT "Extent1"."ERR_LOG_ID" AS "ERR_LOG_ID",
"Extent1"."SRV_LOG_ID" AS "SRV_LOG_ID",
"Extent1"."TS" AS "TS",
"Extent1"."MSG" AS "MSG",
"Extent1"."STACK_TRACE" AS "STACK_TRACE",
"Extent1"."MTD_NM" AS "MTD_NM",
"Extent1"."PRM" AS "PRM",
"Extent1"."INSN_ID" AS "INSN_ID",
"Extent1"."TS_1" AS "TS_1",
"Extent1"."LOG_ETRY" AS "LOG_ETRY",
row_number() OVER (ORDER BY "Extent1"."ERR_LOG_ID" ASC) AS "row_number"
FROM (SELECT "ERRORLOGANDSERVICELOG_VIEW"."ERR_LOG_ID" AS "ERR_LOG_ID",
"ERRORLOGANDSERVICELOG_VIEW"."SRV_LOG_ID" AS "SRV_LOG_ID",
"ERRORLOGANDSERVICELOG_VIEW"."TS" AS "TS",
"ERRORLOGANDSERVICELOG_VIEW"."MSG" AS "MSG",
"ERRORLOGANDSERVICELOG_VIEW"."STACK_TRACE" AS "STACK_TRACE",
"ERRORLOGANDSERVICELOG_VIEW"."MTD_NM" AS "MTD_NM",
"ERRORLOGANDSERVICELOG_VIEW"."PRM" AS "PRM",
"ERRORLOGANDSERVICELOG_VIEW"."INSN_ID" AS "INSN_ID",
"ERRORLOGANDSERVICELOG_VIEW"."TS_1" AS "TS_1",
"ERRORLOGANDSERVICELOG_VIEW"."LOG_ETRY" AS "LOG_ETRY"
FROM "IDS_CORE"."ERRORLOGANDSERVICELOG_VIEW" "ERRORLOGANDSERVICELOG_VIEW") "Extent1") "Extent1"
WHERE ("Extent1"."row_number" > 1933849)
ORDER BY "Extent1"."ERR_LOG_ID" ASC)
WHERE (ROWNUM <= (10))
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 10 | 31750 | | 821K (1)| 02:44:15 |
|* 1 | COUNT STOPKEY | | | | | | |
| 2 | VIEW | | 1561K| 4728M| | 821K (1)| 02:44:15 |
|* 3 | VIEW | | 1561K| 4748M| | 821K (1)| 02:44:15 |
| 4 | WINDOW SORT | | 1561K| 3154M| 4066M| 821K (1)| 02:44:15 |
|* 5 | HASH JOIN OUTER | | 1561K| 3154M| | 130K (1)| 00:26:09 |
| 6 | TABLE ACCESS FULL| IDS_SERVICES_LOG | 1047 | 52350 | | 5 (0)| 00:00:01 |
| 7 | TABLE ACCESS FULL| IDS_SERVICES_ERROR_LOG | 1561K| 3080M| | 130K (1)| 00:26:08 |
Predicate Information (identified by operation id):
1 - filter(ROWNUM<=10)
3 - filter("Extent1"."row_number">1933849)
5 - access("T1"."SRV_LOG_ID"(+)="T2"."SRV_LOG_ID")I did try a sample from stack overflow that would apply it to all string types, but I didn't see any query results differences. Please note, I am having the problem without any order with or where statements. Of course the skip take generates them. Please advise how I would implement the EntityFunctions.AsNonUnicode method with this Linq query.
LINQ
var cnt = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
select errorLog).Count();
var query = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
orderby errorLog.ERR_LOG_ID
select errorLog).Skip(cnt-10).Take(10).ToList();
This is what I inserted into my model to hopefully fix it. FROM:c# - EF Code First - Globally set varchar mapping over nvarchar - Stack Overflow
/// <summary>
/// Change the "default" of all string properties for a given entity to varchar instead of nvarchar.
/// </summary>
/// <param name="modelBuilder"></param>
/// <param name="entityType"></param>
protected void SetAllStringPropertiesAsNonUnicode(
DbModelBuilder modelBuilder,
Type entityType)
var stringProperties = entityType.GetProperties().Where(
c => c.PropertyType == typeof(string)
&& c.PropertyType.IsPublic
&& c. -
Sql for inheritance mapping looks for inherited attributes in base table
i don't know if it is my mistake but....
with inherited attributes (that worked OK in 10.1.3DP3) we are experiencing strange behavoir in that: the sql generated to retrieve implementors of a base class from a base table with additional attributes for subclasses read from joined tables is not valid.
in 10.1.3DP3, the sql is correctly generated such that the attributes for subclasses are selected from the appropriate joined tables
in 10.1.3DP4, the sql is generated such that all fields are selected from the base table, regardless whether these fields are mapped to the base class (base table) or subclasses (joined tables).
what i expect to see is that the base table (usually aliased as t0) AND the joined table for reading subclasses (usually aliased as t1) are used in the sql statement.
instead, all fields are selected from t0.
i have included the generated descriptor code
thank you very much in advance of any help here
regards
paul
base class descriptor: 10.1.3DP3
public ClassDescriptor buildAbstractEnrichmentRuleDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
descriptor.addTableName("ENRICHMENT_RULE");
descriptor.addPrimaryKeyFieldName("ENRICHMENT_RULE.ENRICHMENT_RULE_ID");
// Inheritance Properties.
descriptor.getInheritancePolicy().setClassIndicatorFieldName("ENRICHMENT_RULE.DROP_DOWN_IND");
descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.TextEnrichmentRule.class, "N");
descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class, "Y");
descriptor.getInheritancePolicy().dontReadSubclassesOnQueries();
base class descriptor: 10.1.3DP4
public ClassDescriptor buildAbstractEnrichmentRuleDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
descriptor.addTableName("ENRICHMENT_RULE");
descriptor.addPrimaryKeyFieldName("ENRICHMENT_RULE.ENRICHMENT_RULE_ID");
// Inheritance Properties.
descriptor.getInheritancePolicy().setClassIndicatorFieldName("ENRICHMENT_RULE.DROP_DOWN_IND");
descriptor.getInheritancePolicy().setReadAllSubclassesViewName("ENRICHMENT_RULE");
descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.TextEnrichmentRule.class, "N");
descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class, "Y");
// Descriptor Properties.
descriptor.useNoIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteNoIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setIsIsolated(true);
descriptor.setAlias("AbstractEnrichmentRule");
sub class descriptor:
public ClassDescriptor buildDropDownEnrichmentRuleDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class);
descriptor.addTableName("DROP_DOWN_ENRICHMENT_RULE");
// Inheritance Properties.
descriptor.getInheritancePolicy().setParentClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
descriptor.getInheritancePolicy().dontReadSubclassesOnQueries();
// Descriptor Properties.
descriptor.setIsIsolated(true);
descriptor.setAlias("DropDownEnrichmentRule");
descriptor.setCacheSynchronizationType(ClassDescriptor.DO_NOT_SEND_CHANGES);
...and the exception/ SQL
Problem details
Internal Exception: java.sql.SQLException: ORA-00904: "T0"."DROP_DOWN_SQL": invalid identifier Error Code: 904 Call:SELECT t0.ENRICHMENT_RULE_ID, t0.DROP_DOWN_IND, t0.LABEL_EXPRESSION, t0.COLUMN_NUM, t0.ORDER_PRIORITY, t0.LABEL_NAME, t0.VALUE_EXPRESSION, t0.ENRICHMENT_RULE_TYPE_ID, t0.ENRICHMENT_RULE_ID, t0.DROP_DOWN_SQL FROM ENRICHMENT_RULE t0 WHERE (t0.ENRICHMENT_BASE_ID = ?) bind => [1] Query:ReadAllQuery(com.aon.amp.beans.enrichment.AbstractEnrichmentRule)Hello Paul,
There is a difference in your descriptors that is causing the problem. In the DP3 descriptor, you have selected dontReadSubclassesOnQueries() option, meaning that queries to the base class will only return base class implementations.
The DP4 descriptor instead has setReadAllSubclassesViewName("ENRICHMENT_RULE"), which is telling it that when a query is performed on the base class that TopLink should also return subclasses. It is also telling TopLink to do this in 1 query using the ENRICHMENT_RULE view table - this allows you to specify a view that joins all the inheritance tables. This option is good when you are using cursors and the like but still need to query on the base class to get the subclasses.
Best Regards,
Chris Delahunt -
OWB Error while generating Code for a mapping
I have a simple mapping loading from a source to a flat file. When I try to generate code it gives me the following Error
VLD-2357: Target Data File name not specified for file <target Flat file name>.
I am new to OWB so any help on the same will be greatly appreciated. How can I specify target Data File name in the mapping configuration under Flat file operators
Thanks
AnishIf you configure the mapping in the UI from the main design tree and select the name of your file operator under the tree node 'Flat File Operators' on the right hand side panel the properties should be displayed - one of these properties is 'Target Data File Name', enter the name of your target data file name.
Cheers
David -
Generate sql from mappingtool java class
I have been trying without any luck to get the MappingTool.run(...) method
to generate an SQL update script. To do this I figure that I need to
specify the "sqlWriter" parameter as a valid FileWriter. But the file
mappingtool generates is always empty. Any hints/clues?
Note that I have no problem generating the sql files from ant or commandline
by specifying -sql xxx.sql
Here is my calling code...
Writer dest = new FileWriter(...);
boolean ok =
MappingTool.run(
this.getJDBCConfiguration(), // JDBCConfiguration
MappingTool.ACTION_BUILD_SCHEMA, // action
this.getResourceKeys().getJDOResourceFileNames(), // jdo file names
null, // mappingWriter
SchemaTool.ACTION_ADD,// schemaAction
false,// dropTables
false,// ignoreErrors
true, // readSchema
true, // include pks
true, // include fks
true, // include indexes
null, // schemaWriter
dest, // sqlWriter
this.getClass().getClassLoader() // class loader
Cheers and thanks.
..droo.Does the schema already exist? If so, SchemaTool.ACTION_ADD won't do
anything (nothing to add). Try SchemaTool.ACTION_BUILD -
Generating names for instanses of classes dynamically pls help????
Hi this is what i am trying to do. I have two classes. 1)DragDrop and 2) Create. In the create class I want to declare an instance of DragDrop and call a method from the DragDrop class. The method i want to call is to draw an object to the screen. So if i wanted to draw one object the call would be:
DragDrop d = d.add(object)
I do not know how many objects need to be drawn till runtime, and I also need to be able to know the variable name assigned to the instance of the class, so for 100 objects i will need to know 100 variable names, this is so that each object can be manipulated and i need the variable name to do this. What i want to know is how can i assign different variable names depending on the number of objects that need to be drawn, i have considered using hashmaps but still don't see how it would be possible, any help would be much appreciated. Thanks.It's not possible. A Map is the closest you can get.
-
OBIEE generated SQL differs if it's a Physical Table or Select Table...
Hi!
I have some tables defined in the Physical Layer, which some are Physical Tables and others are OBIEE "views" (tables created with a Select clause).
My problem is that the difference in the generated SQL for the same table, differs (as expected) whether it is a Physical Table or a "Select Table". And this difference originates problems in the returned data. When it a Physical Table, the final report returns the correct data, but when it is a Select Table it returns incorrect/incomplete data. The report joins this table with another table from a different Database (it is a join between Sybase IQ and SQL Server).
This is the generated SQL in the log:
-- Physical Table generated SQL
select T182880."sbl_cust_acct_row_id" as c1,
T182880."sbl_cust_acct_ext_key" as c2,
T182880."sbl_cust_source_sys" as c3
from
"SGC_X_KEY_ACCOUNT" T182880
order by c2, c3
-- "Select Table" generated SQL
select
sbl_cust_acct_ext_key,
ltrim(rtrim(sbl_cust_source_sys)) as sbl_cust_source_sys,
sbl_cust_acct_row_id,
sbl_cust_acct_camp_contact_row_id,
ods_date,
ods_batch_no,
ods_timestamp
from dbo.SGC_X_KEY_ACCOUNT
As you may notice, the main difference is the use of Aliases (which I think that it has no influence in the report result) and the use of "Order By" (which I start to think that it its the main cause to return the correct data).
Don't forget that OBIEE server is joining the data from this table, with data from another table from a differente database. Therefore, the join is made in memory (OBIEE Engine). Maybe in the OBIEE Engine the Order by is essential to guarantee a correct join...but then again, I have some other tables in the Physical Layer that are defined as "Select" and the generated SQL uses the aliases and the Order by clause...
In order to solve my problem, I had to transform the "Select Table" into a "Physical Table". The reason it was defined as a "Select Table" was because it had a restriction in the Where Clause (which I eliminated already, althouth the performance wil be worse).
I'm confused. Help!
Thanks.
FPGHi FPG,
Not sure if this is a potential issue for you at all, but I know it caused me all kinds of headaches before I figured it out. Had to do with "Features" tab Values in the database object's settings in the Physical Layer:
Different SQL generated for physical table query vs. view object query?
Mine had to do with SQL from View objects not being submitted as I would expect, sounds like yours has more to do with "Order By"? I believe I remembered seeing some Order By and Group By settings in the "Features" list. You might make a copy of your RPD and experiement around with setting some of those if they aren't already selected and retesting your queries with the new DB settings.
Jeremy -
SQL for pulling description from product identification section off of summ
I tried using the DB schema tool to generate sql for pullling the Description field off of the Product Indentification section on the summary tab and it came up with zero records even though i know we have a few 1,000 specs that use that field.
Can you send me the sql that i should be using or the table to look in to find that text??
thanks,
DavidThis should get you started,
select
ss.SpecNumber as "Spec Number"
, ssn.name as "Spec Name"
, sdftp.Description as "Description"
from SpecDescriptionFreeTextProp sdftp
inner join gsmProductIdentification gpi on sdftp.fkSpecID = gpi.pkid
inner join SpecSummary ss on gpi.fkSpecID = ss.SpecID
inner join SpecSummaryName ssn on ssn.fkSpecsummary = ss.PKID
where
ssn.langid = 0 -
Can we change/Modify BI server generated Sql query and run to fetch data
Hi,
My client is saying that there is an option to modify bi server generated sql query to fetch data from source.
question:As a request is made in presentation services, A dynamic sql query is generated and fetches data from source. all this is loggedin Nqlquery log..well can we change/modify the sql query generated and run modified sql query to fetch data from source. ., if so how? if not why?
Thanks in advance
Edited by: user10794468 on Jun 16, 2009 6:29 PM
Edited by: user10794468 on Aug 12, 2009 6:58 PMThank you so much for your reply..
..Can we also modify sql query generated by bi server to fetech data. the query's which we see in query log file.. -
How to see generated SQL when execute JPQL query using entity manager?
I want to see generated SQL query in console or in a log file. How do I do that?
I'm using GlassFish if it mattersIf you want to see SQL query that is generated from JPQL in GlassFish console you should do following:
Log on admin console.
Select 'Application Server' from tree, then select Logging tab and Log Levels sub-tab.
Log level for 'Persistence' must be set to FINE or level with more verbosity. -
Kodo JDO EE 2.3 RC1 (with InstantDB on JBoss 3.0 on JDK 1.3.1 on Mac
OS X 10.1.5) generates wrong SQL for a JDO query with a parameter.
Essentially (unimportant details omitted) I have the following:
2 associated persistence-capable classes
public class Person
private String name;
public class Issue
private int id;
private Person owner;
both with application-managed identity (Person by name, Issue by id),
both in the same package. I want to search the database for all Issues
owned by a certain Person. My code looks like this:
@pre p is persistent
Collection findByOwner(Person p){
// pm is the PersistenceManager
//TODO pm.newQuery(Issue.class, filter) does not work with Kodo 2.3 RC1
Extent extent = pm.getExtent(Issue.class, true);
Query query = pm.newQuery(extent, "owner==person");
query.setClass(Issue.class);
query.setIgnoreCache(true);
query.declareParameters(Person.class.getName() + " person");
return (Collection)query.execute(p);
and produces the following SQL statement
SELECT t0.IDX, t0.JDOCLASSX, t0.JDOLOCKX, t0.NAME_OWNERX FROM ISSUEX
t0, PERSONX t1 WHERE (t1.NAMEX = NULL AND t0.NAME_OWNERX = t1.NAMEX)
which is wrong because the actual p.name, which is definitely not nil,
got lost, and is even rejected by the database*, probably because
NAMEX is the primary key and cannot be NULL.
I am pretty sure that this used to work correctly with Kodo 2.2.4. Can
anyone tell me what I could be doing wrong? I will provide the full
source code at request.
Thanks,
Jakob
* SQLException:
Don't understand SQL after: "WHERE"
Expected: "{" found: "NULL"This issue has been resolved in internal builds.
Some tangential notes about the code below:
- in our latest version, we no longer require extents when executing
queries (the candidate class is sufficient).
- I'm a little concerned about where the 'pm' variable came from in
Issue.findByOwner(). If that's a member variable, you'd be better off
doing 'JDOHelper.getPersistenceManager (this)' instead of caching it on
your own -- this way, you'll avoid any potential issues with somehow
using the wrong PM or something.
- Given that all the info is stored in the database already, I'd suggest
making the relation a bidirectional one, so that you can just traverse
from Issue to Person without needing to do a query. This will be faster,
as we will be able to leverage our PM and PMF caches rather than needing
to execute a query against the data store.
-Patrick
Jakob Spies <[email protected]> wrote:
Kodo JDO EE 2.3 RC1 (with InstantDB on JBoss 3.0 on JDK 1.3.1 on Mac
OS X 10.1.5) generates wrong SQL for a JDO query with a parameter.
Essentially (unimportant details omitted) I have the following:
2 associated persistence-capable classes
public class Person
private String name;
public class Issue
private int id;
private Person owner;
both with application-managed identity (Person by name, Issue by id),
both in the same package. I want to search the database for all Issues
owned by a certain Person. My code looks like this:
@pre p is persistent
Collection findByOwner(Person p){
// pm is the PersistenceManager
//TODO pm.newQuery(Issue.class, filter) does not work with Kodo 2.3 RC1
Extent extent = pm.getExtent(Issue.class, true);
Query query = pm.newQuery(extent, "owner==person");
query.setClass(Issue.class);
query.setIgnoreCache(true);
query.declareParameters(Person.class.getName() + " person");
return (Collection)query.execute(p);
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com -
Using a SQL for Oracle in Microsoft Excel Query
I am having the most difficult time (in fact, I can't get it to work) trying to use an SQL I created in Toad for Oracle. It works fine in Toad for Oracle...gives me all the data I need. I am trying to use it in Excel for users that don't know SQL or Oracle so they can use the query to extract data they need for Charts, Graphs, etc.
Here is the SQL code from Toad for Oracle:
/* Formatted on 2006/09/22 11:42 (Formatter Plus v4.8.6) */
SELECT a_compl_summary.incident_number, a_compl_summary.case_number,
a_compl_summary.part_sequence, a_compl_summary.part_number,
a_compl_summary.lot_number, a_compl_summary.alert_date,
a_compl_summary.entry_date, a_compl_summary.NAME,
a_compl_summary.MONTH, a_compl_summary.product_family,
a_compl_summary.complaint, a_compl_summary.reportable,
a_compl_summary.product_returned, a_compl_summary.case_desc,
a_compl_summary.failure_invest_desc, a_compl_summary.lhr_search,
a_compl_summary.root_cause, a_compl_summary.corrective_action,
a_compl_summary.region,
rp_qa_reported_device_codes.reported_device_code,
rp_qa_reported_device_codes.reported_dev_clarification,
rp_qa_reported_device_codes.reported_dev_code_desc,
rp_qa_patient_codes.patient_code,
rp_qa_patient_codes.patient_code_clarif,
rp_qa_patient_codes.patient_code_severity,
rp_qa_patient_codes.description
FROM chsuser.a_compl_summary,
chsuser.rp_qa_patient_codes,
chsuser.rp_qa_reported_device_codes
WHERE ( (a_compl_summary.product_division = 'CP')
AND ( a_compl_summary.entry_date >= :date1
AND a_compl_summary.entry_date <= :date2
AND ( a_compl_summary.product_family LIKE :pf1
OR a_compl_summary.product_family LIKE :pf2
OR a_compl_summary.product_family LIKE :pf3
OR a_compl_summary.product_family LIKE :pf4
OR a_compl_summary.product_family LIKE :pf5
AND (a_compl_summary.region = :r1)
AND ( a_compl_summary.NAME = :c1
OR a_compl_summary.NAME = :c2
OR a_compl_summary.NAME = :c3
OR a_compl_summary.NAME = :c4
OR a_compl_summary.NAME = :c5
AND (a_compl_summary.complaint = :yorn)
AND ( rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl1
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl2
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl3
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl4
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl5
AND (rp_qa_reported_device_codes.reported_dev_clarification NOT LIKE
:dc1
AND (a_compl_summary.incident_number =
rp_qa_patient_codes.incident_number
AND (a_compl_summary.case_number = rp_qa_patient_codes.case_number)
AND (a_compl_summary.part_sequence = rp_qa_patient_codes.part_sequence
AND (a_compl_summary.incident_number =
rp_qa_reported_device_codes.incident_number
AND (a_compl_summary.case_number =
rp_qa_reported_device_codes.case_number
AND (a_compl_summary.part_sequence =
rp_qa_reported_device_codes.part_sequence
AND (rp_qa_reported_device_codes.incident_number =
rp_qa_patient_codes.incident_number
AND (rp_qa_reported_device_codes.case_number =
rp_qa_patient_codes.case_number
AND (rp_qa_reported_device_codes.part_sequence =
rp_qa_patient_codes.part_sequence
)Can someone help me...maybe point out what I'm doing wrong.
Note: I also tried creating this query in Microsoft Query (the simple way) and when I first create it...it works...But then if I go back in to edit the query, and refresh the query or try to Return data to Excel, it gives me a ORA-00936 error message.
Why it works when I first create the query in Excel, I don't know. But I have to validate the queries I'm creating (SQL or not) and I can't validate it if every time I go into edit the query (which may have to happen; that's why I have to fix this before I can submit my validation).
Anyway, any help would be greatly appreciated.Okay, I know I'm replying to my own threads here...but I want to add a little bit more information again.
I was successful in figuring out that changing the :criteria to a ? worked.
I tested this on 1 criteria at a time. Adding one more scenario ? at at time.
It only worked up until about 3 scenarios of each criteria.
Then when I refreshed the query in Microsoft Excel Query, I got an "out of memory" error, and then it ended up just erasing the SQL I had been using.
Here's the SQL I had where it gave me this error. Am I possibly just making Excel work too hard? It just doesn't make sense because Toad for Oracle handled it in like 4 seconds. Which brings me back to an intial question I had. Can Excel use Toad for Oracle somehow?
Here's the code:
SELECT a_compl_summary.incident_number, a_compl_summary.case_number,
a_compl_summary.part_sequence, a_compl_summary.part_number,
a_compl_summary.lot_number, a_compl_summary.alert_date,
a_compl_summary.entry_date, a_compl_summary.NAME,
a_compl_summary.MONTH, a_compl_summary.product_family,
a_compl_summary.complaint, a_compl_summary.reportable,
a_compl_summary.product_returned, a_compl_summary.case_desc,
a_compl_summary.failure_invest_desc, a_compl_summary.lhr_search,
a_compl_summary.root_cause, a_compl_summary.corrective_action,
a_compl_summary.region,
rp_qa_reported_device_codes.reported_device_code,
rp_qa_reported_device_codes.reported_dev_clarification,
rp_qa_reported_device_codes.reported_dev_code_desc,
rp_qa_patient_codes.patient_code,
rp_qa_patient_codes.patient_code_clarif,
rp_qa_patient_codes.patient_code_severity,
rp_qa_patient_codes.description
FROM chsuser.a_compl_summary,
chsuser.rp_qa_patient_codes,
chsuser.rp_qa_reported_device_codes
WHERE ( (a_compl_summary.incident_number =
rp_qa_patient_codes.incident_number
AND (a_compl_summary.case_number = rp_qa_patient_codes.case_number)
AND (a_compl_summary.part_sequence = rp_qa_patient_codes.part_sequence
AND (a_compl_summary.incident_number =
rp_qa_reported_device_codes.incident_number
AND (a_compl_summary.case_number =
rp_qa_reported_device_codes.case_number
AND (a_compl_summary.part_sequence =
rp_qa_reported_device_codes.part_sequence
AND (rp_qa_reported_device_codes.incident_number =
rp_qa_patient_codes.incident_number
AND (rp_qa_reported_device_codes.case_number =
rp_qa_patient_codes.case_number
AND (rp_qa_reported_device_codes.part_sequence =
rp_qa_patient_codes.part_sequence
AND (a_compl_summary.product_division = 'CP')
AND ( a_compl_summary.entry_date >= ?
AND a_compl_summary.entry_date <= ?
AND ( a_compl_summary.product_family LIKE ?
OR a_compl_summary.product_family LIKE ?
OR a_compl_summary.product_family LIKE ?
OR a_compl_summary.product_family LIKE ?
OR a_compl_summary.product_family LIKE ?
AND (a_compl_summary.region = ?)
AND ( a_compl_summary.NAME = ?
OR a_compl_summary.NAME = ?
OR a_compl_summary.NAME = ?
OR a_compl_summary.NAME = ?
OR a_compl_summary.NAME = ?
AND (a_compl_summary.complaint = ?)
AND ( rp_qa_reported_device_codes.reported_dev_clarification LIKE
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
AND (rp_qa_reported_device_codes.reported_dev_clarification NOT LIKE
))
Maybe you are looking for
-
Help with scripting: need to import Excel files into PS type layers
Howdy all, I have a series of TV commercials provided to me as layered PS files. I work in CS3 and export to Avid for editing. For customization, I need to import their Excel list of phone numbers and duplicate each one into a type layer with existi
-
My dad put a new mac in and the old Mac had my photos on it, and I checked iPhoto after it the new computer was plugged in and there was no photos in it, and my dad said that they should be in there but they aren't, so is there a way to get my photos
-
My iPod Touch 3G is running ios 5.1.1 and the music library isn't aphabetical. It's all messed up. I could post a picture if needed. I wanted to see if Apple could create a ios update just to fix this.
-
G4 shuts down when trying to sleep or restart
Hello, I've looked around on the forums but can't find the same problem as mine. When I try putting my G4 to sleep, it powers off right away. Same thing when trying to restart, it just shuts down. If it hasn't been on too long, I can press the power
-
ToDo Items Not Appearing In Published iCal Calendar
We are a group of homeschool, high school students using iCal together. We each have MobileMe and use it to publish our calendars. Some published calendars show the users todo list, some don't. We have checked to make sure that todo items are publish