String Binding in plsql
Hi All,
I have two table, the first table(emp) contains few columns LIKE
eno, ename etc. with some data. In my second table(eval1) I
have one column which holds column names of first table ex.
ename. How can I get the column value of first table based on
columns entered in second table. The ex. Which I am trying.
table1 : emp
eno ename sal
1 james 1000
2 bond 2000
table2 : eval1
col1
ename
procedure p1 is
cursor data1 is select * from emp;
cursor c_val is select col1 fromtable2 ;
p_col varchar2(100);
BEGIN
for r_data in data1 loop
FOR R_VAL IN C_VAL LOOP
BEGIN
p_col := 'r_data.'||r_val.col1;
select p_col into p_out from dual ;
dbms_output.put_line('chr(10) 1 '||p_out);
END;
END LOOP;
END LOOP;
END;
What I am expecting from above code is, the p_out should
return 'james', 'bond'.... for each record. Right not it is just
returning r_data.ename.
Please help me. Thanks in advance.
Swetha.
Hi,
This is a case of Dynamic Sql where u will want to dynamically
create the query.
Create procedure p1 is
cursor data1 is select * from emp;
cursor c_val is select col1 fromtable2 ;
p_col varchar2(100);
BEGIN
for r_data in data1 loop
FOR R_VAL IN C_VAL LOOP
BEGIN
p_col := 'r_data.'||r_val.col1;
execute immediate 'select ' || p_col || ' from emp'
into p_out;
dbms_output.put_line('chr(10) 1 '||p_out);
END;
END LOOP;
END LOOP;
END;
You can also Ref Cursors.
Regards,
Ganesh R
Similar Messages
-
String binding + character replacement
When I use string binding to update Long datatypes with the Oracle thin jdbc driver I find that all £ characters are replaced with ¿
Is this a bug in the driver or do I need to change a character set setting somewhere?
NB the character replacement doesn't happen when I just use a straightforward update statementWhat is the database character set?
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Character replacement + String binding
Toplink seems to use string binding with updates that can contain strings over a certain length. This is fine in most cases but when the string contains pound signs (£) the character stored to the DB is ¿. This doesn't happen when toplink does a straight forward update.
Does anyone one know of a way to either stop toplink from using string binding or to prevent character replacement when string binding is used?
Many thanks
EjThere is a login setting to configure string binding.
session/project.getLogin().setUsesStringBinding(false);
session/project.getLogin().setStringBindingSize(255);
Note that the default is false, so you must already be setting it to true somewhere.
In general it seems that your JDBC driver is not handling the pound sign correctly when binding is used, you may wish to also report this to your JDBC provider. -
Search for string in PlSql-Code
Hi
I have a simple question. Is it possible to search for a string in all PlSql-Proceduren (Packages, Procedures, Functions, Triggers, Views). How can i find out where a certain package-prodedure/function is referenced.
ThanksView -> Extended search. In 11.1 it would query against plscope dictionary views supported by rdbms. In lower versions it would reduce to querying all_source.
-
Simple PHP and PLSQL Bind help needed
HI,
I am learning php and oracle I am trying to bind my plsql code with php but have little idea can anyone plese help?.
my code is
plsql prcoedure
CREATE OR REPLACE PROCEDURE get_width (
img_id IN arm_photos.id%TYPE
AS
image ORDSYS.ORDImage;
width INTEGER;
BEGIN
SELECT p.image INTO image FROM arm_photos p
WHERE p.id = img_id;
-- Get the image width:
width := image.getWidth();
DBMS_OUTPUT.PUT_LINE('Width is ' || width);
COMMIT;
END;
PHP code
<?php
$c =oci_connect('user', 'pass' , '//localhost/orcl');
$s = oci_parse($c, " begin
get_width(:id :width)");
oci_bind_by_name($s, ':id', $id);
oci_bind_by_name($s, ':width', $width);
$id= 1235;
oci_execute($s);
?>Variable width is a local variable. You can't get its value from outside SP. Either change your procedure to a function returning image width or add a second out parameter:
CREATE OR REPLACE PROCEDURE get_width (
img_id IN arm_photos.id%TYPE,width OUT INTEGER
AS
image ORDSYS.ORDImage;
BEGIN
SELECT p.image INTO image FROM arm_photos p
WHERE p.id = img_id;
-- Get the image width:
width := image.getWidth();
DBMS_OUTPUT.PUT_LINE('Width is ' || width);
COMMIT;
END;SY. -
Hi guys! I badly need your help.
I'm trying to bind string[] variable in Java(IDCGetInfoResult) to another string[] in JavaFX (simpleList).
However, I can't seem to be able to do so.
The code statement highlighted in red generates an error message:
the target type of a bind cannot be an array
found: native array of string
required: object or sequence
IDCGetInfoResult -> array of strings in control.java
var simpleList: String[] = bind r.control.getIDCGetInfoResult();
var simpleListView : ListView = ListView {
translateX: 0
translateY: 0
layoutX: 20
layoutY: 80
height: 130
width: 200
items: simpleList
for(i in [0..simpleList.size()-1])
insert simpleList[i] into simpleListView.items;
}By the way, I'm using the Observer and Observable class as suggested by this blog post:
http://blogs.sun.com/michaelheinrichs/entry/binding_java_objects_in_javafx
Edited by: tsubaki.pw on Jan 27, 2010 10:43 PM
Edited by: tsubaki.pw on Jan 27, 2010 10:45 PMOK, I came with a quite convoluted solution, it might be a starting point for real code...
Part of the complexity comes because I didn't want to make my class extending Observable.
A recent thread ([cannot find java.util.Observable in JavaFX application|http://forums.sun.com/thread.jspa?threadID=5425241]) reminded that we cannot bind a Java variable from JavaFX, so we have to use Observable and Observer pair.
Here is my test code:
ObservableData.java import java.util.*;
public class ObservableData
ArrayList<String> info = new ArrayList<String>();
Notifier notifier = new Notifier();
ObservableData(Observer obs)
addObserver(obs);
void init()
for (int i = 0; i < 10; i++)
info.add("Item " + i);
notifier.change();
notifier.notifyObservers();
ArrayList<String> getData()
return info;
void addObserver(Observer obs)
notifier.addObserver(obs);
void update(int n)
String newItem = "Item " + n;
System.out.println("Update => " + newItem);
info.add(newItem);
notifier.change();
notifier.notifyObservers(newItem);
public String toString()
return info.toString();
static class Notifier extends Observable
public void change() { setChanged(); }
Test.fx class Watcher extends java.util.Observer
override function update(obs: java.util.Observable, ob: Object): Void
def updatedItem = ob as String;
println("Update with '{updatedItem}'");
def list = javaData.getData();
println(list.toString());
simpleList = for (item in list) item as String;
var javaData = new ObservableData(Watcher {});
var simpleList: String[];
var simpleListView: ListView = ListView {
translateX: 0
translateY: 0
layoutX: 20
layoutY: 80
height: 130
width: 200
items: bind simpleList
var b = Button
text: "Update"
action: function (): Void
def val = 10 + Math.random() * 100 as Integer;
println("Update with {val}");
javaData.update(val)
var scene: Scene;
Stage
title: "Observing Java data"
scene: scene = Scene
width: 300
height: 300
content:
b, simpleListView
javaData.init(); // Placement is important! If you want the list view to be initializedHere I refresh the whole content of the list view; depending on the data and the way to update it, you can use the updatedItem value to do a partial update. -
XQuery - Example for binding strings
The example in this article - http://www.oracle.com/technology/sample_code/tech/xml/xmldb/jxqi.html for string binding does not work, as the PreparedXQuery setString api signature is not setString(String, String), as mentioned in the article.
May be the api changed. The current api - setString(QName, String).
So, how can the string be bound.
Pasting example from the article as below.
PreparedXQuery xq = ctx.prepareXQuery(
" for $iN document(bind(\"filename\")) "+
" WHERE $b/publisher = 'Addison-Wesley' "+
" AND $b/@year > 1991 " +
" RETURN <book year={ $b/@year }> "+
" { $b/title } </book> ");
So, how can filename be defined in the code.
Thank in advance.
Malkit S. BhasinHi,
The article you are looking at was written well before the XQJ standard (JSR225) was finalised. You should be able to find your answer in the XQJ documentation.
HTH
Chris -
NLS issue in Java/PLSQL code [ using ROWID]
I have NLS related question regarding the following scenario in Java/PLSQL code ::-
OracleResultSet ors = (OracleResultSet) stmt.executeQuery("select rowId from t where t.col = 'XX'");
// The above query could return multiple rowIds.
String strVal1 = null;
String strVal2 = null;
if(ors.next())
strVal1 = ors.getROWID(1).stringValue();
if(ors.next())
strVal2 = ors.getROWID(1).stringValue();
ArrayList strList = new ArrayList();
strList.add(strVal1);
strList.add(strVal2);
Now I need to pass a list of rowId's from Java to PLSQL function f().
oracle.sql.ARRAY rowListArr = convertArrayListToRowPointerList(strList, conn) ;
OracleCallableStatement cstmt = (OracleCallableStatement)
cstmt.prepareCall("begin f(?); end;");
cstmt.setObject(1, rowListArr);
cstmt.execute();
where:-
static oracle.sql.ARRAY convertArrayListToRowPointerList(ArrayList arr, Connection conn)
throws SQLException {
oracle.sql.ArrayDescriptor stDesc = ArrayDescriptor.createDescriptor
("DBUSER.ROWPOINTERLIST", conn);
oracle.sql.Datum[] keyVals= new oracle.sql.Datum[arr.size()];
for(int i = 0; i < arr.size(); i++) {
keyVals[i] = new oracle.sql.CHAR((String) arr.get(i),
oracle.sql.CHAR.DEFAULT_CHARSET);
oracle.sql.ARRAY keyArr = new oracle.sql.ARRAY(stDesc, conn, keyVals);
return keyArr;
and
create or replace type DBUSER.ROWPOINTERLIST as table of varchar2(4000);
Will there be NLS issues in the above code, where I pass the rowId content
that I obtain from one query, as array of string bind variables to a subsequent PLSQL procedure? --- first approach
Or
do I need to pass the rowId list , as a array of oracle.sql.ROWID via bind variables? -- second approach
The problem I have in second approach is that in the DB we cannot define a type as a table of ROWID's. So currently I have RowPointerList as a table of varchar2's (note the length of list of rowId is not predetermined in my case, so I user table instead of varray).
However I was wondering if the first approach will have any NLS issues.
Will appreciate your comments.
ThanksROWIDs are represented as either hex-encoded values or base64 encoded values. Both encodings use pure ASCII, so there should be no NLS issues.
I am not very familiar with the oracle.sql.ARRAY type, but unless absolutely necessary, I would avoid the oracle.sql.CHAR datatype (assuming 10g drivers). Using java.lang.String is preferred.
-- Sergiusz -
PanelGrid with binding attribute not rendering when event on page fires
I am having a similar issue with my components not being rendered from a dynamic binding attribute as described by this post:http://forum.java.sun.com/thread.jspa?threadID=671672 but for different reason. I have combed the forum and other sources for a week now, tried numerous variations of this based on suggestions I've read for rendering dynamic components and am unable to find the problem. I would appreciate guidance as I don't know what else to do and I imagine there is something basic about the JSF flow layout or component classes I am not doing correctly.
From a high level, I have a page with two panel groups. The first contains a list of command links (like a menu) that have an actionlistener that populates a list of QueryVariable objects called filterCriteria in the backing bean based on the selection made and then calls a function to update components in the second panel. The second panelGroup contains a panelGrid with a binding attribute that constructs a dynamic set of input fields based on the content of the filterCriteria list. When I first naviagate to this page from another page, the fields are rendered properly. However, if I then select a commandLink from the menu, the panelGrid disappears and is not rendered.
I've stepped through the code in a debugger and my actionlistener is called when I select a command link. However, the binding attribute method is not called at this time, so I added a direct call to it from the action listener. I know the actionlistener is working because I've verified it in the debugger and if I navigate away and come back to the page, then the binding method is called and the new selection is reflected in a rendered panelGrid. Why is it not rendering though when I first select the commandLink and the page is updated. Also, fyi, there is an action method for the commandlinks but it returns null;
FWIW, I'm using MyFaces and Facelets in my application.
Below is my code. This is inside a managed session bean:
JSF Snippet:
<h:panelGrid id="inputVarsTable" columns="3" binding="#{query.table}"/>
public HtmlPanelGrid getTable() {
if(table == null)
table = new HtmlPanelGrid();
return constructSearchInputTable();
public void setTable(HtmlPanelGrid table) {
this.table = table;
// Updates table component to reflect filterCriteria
public HtmlPanelGrid constructSearchInputTable()
HtmlOutputLabel outLabel;
HtmlOutputText outText;
HtmlInputText inText;
HtmlMessage message;
List<UIComponent> children;
ValueBinding vb;
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot uIViewRoot = facesContext.getViewRoot();
Application application = facesContext.getApplication();
children = table.getChildren();
children.clear();
try {
for (int i = 0; i < getFilterCriteria().size(); i++) {
QueryVariable var = getFilterCriteria().get(i);
String id = "var" + i;
//<h:outputLabel for="#{var.name}" styleClass="label">
outLabel = new HtmlOutputLabel();
outLabel.setFor(id);
outLabel.setStyleClass("label");
// <h:outputText value="#{var.name}" />
outText = new HtmlOutputText();
outText.setValue(var.getName());
outText.setParent(outLabel);
outLabel.getChildren().add(outText);
outLabel.setParent(table);
children.add(outLabel);
//<h:inputText id="#{var.name}" value="#{var.value}" required="true" />
inText = new HtmlInputText();
inText.setId(id);
String bind = "#{query.filterValues['" + var.getName() + "']}";
inText.setValueBinding("value", application.createValueBinding(bind));
if(var.getDefaultValue() == null)
inText.setRequired(true);
inText.setParent(table);
children.add(inText);
//<h:message for="#{var.name}" styleClass="errorText"/>
message = new HtmlMessage();
message.setFor(id);
message.setStyleClass("errorText");
message.setParent(table);
children.add(message);
} catch (Exception e) {
log.error(e);
return table;
// Command Link Menu ActionListener
public void structuredQuerySelection(ActionEvent e) {
queryType = QueryType.StructuredQuery;
UICommand cmd = (UICommand) e.getSource();
filterSelection = (String) cmd.getValue();
Map<String, SearchRequestCtx> queries = pdp.getGenericMetadata().savedQueries;
SearchRequestCtx ctx = queries.get(filterSelection);
filterCriteria = new ArrayList<QueryVariable>();
filterCriteria.addAll(ctx.getVariables());
constructSearchInputTable();
// Command Link Menu Action
public String selectStructuredQuery()
return null;
}BTW, this is my first post and I don't really know how that Duke Dollar thing works but I'm happy to offer some to anyone that can solve this issue for me.
Thanks,
KenGlad to hear I am not the only one struggling with this type of issue.
I tried your suggestion but it caused a NoSuchElementException when the page tried to render. Stepping through the code, the init function is always called after my panelGrid is constructed. I even commented out the logic to clear the children and confirmed that in the constructed page, the outputText component that binds to init is the first element on the page - right after the opening body tag. Maybe, JSF doesn't necessarily construct the page in top to bottom order? Also, the exception makes me think that this gets called too late in the lifecycle to work. Were you able to get this to work?
java.util.NoSuchElementException
at java.util.AbstractList$Itr.next(AbstractList.java:427)
at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:515)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:445)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)Ken -
How to pass a list as bind variable?
How can I pass a list as bind variable in Oracle?
The following query work well in SQL Developer if I set ":prmRegionID=2".
SELECT COUNTRY_ID,
COUNTRY_NAME
FROM HR.COUNTRIES
WHERE REGION_ID IN (:prmRegionID);
The problem is that I can't find how to set ":prmRegionID=2,3".
I know that I can replace ":prmRegionID" by a substitution variable "&prmRegionID". The above query work well with"&prmRegionID=2" and with "&prmRegionID=2,3".
But with this solution, I lost all advantage of using binds variables (hard parse vs soft parse, SQL injection possibility, etc.).
Can some one tell me what is the approach suggest by Oracle on that subject? My developer have work a long time too find how but didn't found any answer yet.
Thank you in advance,
MBBlais wrote:
The problem is that I can't find how to set ":prmRegionID=2,3".Wrong problem. Setting the string bind variable to that means creating a single string that contains the text "+2,3+". THE STRING DOES NOT CONTAIN TWO VALUES.
So the actual problem is that you are using the WRONG data type - you want a data type that can have more than a single string (or numeric) value. Which means that using the string (varchar2) data type is the wrong type - as this only contains a single value.
You need to understand the problem first. If you do not understand the problem, you will not realise or understand the solution too.
What do you want to compare? What does the IN clause do? It deals with, and compares with, a set of values. So it needs a set data type for the bind variable. A set data type enables you to assign multiple values to the bind variable. And use this bind variable for set operations and comparisons in SQL.
Simple example:
SQL> --// create a set data type
SQL> create or replace type TStringSet is table of varchar2(4000);
2 /
Type created.
SQL>
SQL>
SQL> var c refcursor
SQL>
SQL> --// use set as bind variable
SQL> declare
2 names TStringSet;
3 begin
4 --// assign values to set
5 names := new TStringSet('BLAKE','SCOTT','SMITH','KING');
6
7 --// use set as a bind variable for creating ref cursor
8 open :c for
9 'select * from emp where ename in (select column_value from TABLE(:bindvar))'
10 using names;
11 end;
12 /
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7698 BLAKE MANAGER 7839 1981/05/01 00:00:00 2850 30
7788 SCOTT ANALYST 7566 1987/04/19 00:00:00 3000 20
7369 SMITH CLERK 7902 1980/12/17 00:00:00 800 20
7839 KING PRESIDENT 1981/11/17 00:00:00 5000 10
SQL>
SQL> --// alternative set comparison
SQL> declare
2 names TStringSet;
3 begin
4 --// assign values to set
5 names := new TStringSet('BLAKE','SCOTT','SMITH','KING');
6
7 --// use set as a bind variable for creating ref cursor
8 open :c for
9 'select * from emp where TStringSet(ename) submultiset of (:bindvar)'
10 using names;
11 end;
12 /
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 1980/12/17 00:00:00 800 20
7698 BLAKE MANAGER 7839 1981/05/01 00:00:00 2850 30
7788 SCOTT ANALYST 7566 1987/04/19 00:00:00 3000 20
7839 KING PRESIDENT 1981/11/17 00:00:00 5000 10
SQL> -
Binding multiple instance variables of multiple objects
So I got this problem and cant figure out a solution. It seems to be a quite simple pattern but Im really new to jfx....
Follows an imaginary code that kind of represents the problem in my real code:
class A {
public var vA: String;
//...code that updates vA according to a specific logic
class B {
var seq: A[];
public function addA(a: A) {
insert a into seq;
public function removeA....
//how to monitor if one of the elements (OR logic) in seq have changed vA to say print the new value?
//I mean, how can I bind each vA of each instance in seq to a trigger that will print the new value?
}Note: The size of sequence increases/decreases as the user add or remove elements dynamically.
This does not work since the bind dependencies in the for are not affected by varA:
var newseq: String[] = bind for(a in seq) {a.varA} on replace {println(newseq)}This is not allowed by the compiler:
var newseq: String[] on replace {println(newseq)};
for(a in seq) {
newseq[i] = bind a.varA; //incorrect syntax: seems that its not allowed to bind each individual sequence element through indexing
i +=1;
}Is there any obvious solution to this problem? Am I'm taking the wrong path?
Thanks.OK, here is my latest version:
class A
public var vA: String on replace
notifier(this);
public-init var notifier: function (a: A): Void;
public override function toString() { return vA; }
class B {
public-read var seq: A[] = for (i in [ 1 .. 10 ]) getA()
on replace prevSeq[ lowIdx .. highIdx ] = usedSeq
if (usedSeq == []) // Delete operation
delta = prevSeq[lowIdx].toString();
else
delta = usedSeq[0].toString();
public-read var delta: String;
public function add(): Void
insert getA() into seq;
public function remove(): Void
def p = (Math.random() * (sizeof seq)) as Integer;
delete seq[p];
public function changeObj(): Void
def p = (Math.random() * (sizeof seq)) as Integer;
seq[p] = getA();
public function changeVar(): Void
def p = (Math.random() * (sizeof seq)) as Integer;
def val = getVal();
seq[p].vA = val;
println(val);
function getVal(): String
def dt = DateTime {}
return "{%1$tH:%1$tM:%1$tS:%1$tL dt.instant}"
function getA(): A
return A { vA: getVal(), notifier: updated }
function updated(a: A): Void
delta = "Value changed: {a.vA}";
var b = B {}
var scene: Scene;
Stage
title: "Sequence Update Observer"
scene: scene = Scene
width: 200
height: 700
content:
VBox
layoutX: 20, layoutY: 20
spacing: 10
content:
Button { text: "Add", action: b.add }
Button { text: "Del", action: b.remove }
Button { text: "Change Obj", action: b.changeObj }
Button { text: "Change Var", action: b.changeVar }
Text
content: bind b.delta
ListView
items: bind b.seq
}Note: when I change the value, the ListView doesn't change its content, as it is not aware either of any change.
I haven't investigated to see how to compensate the issue, since that's not the main topic of the thread. -
Business Component views in PLSQL
Hello,
We are using ADF for developing a new application. We are using Business component views(BCPs) which are written in PLSQL using instead of triggers.
. I searched the internet for some examples but I did not find any, all BCPs seem to be in Java. I wanted to know if you know of any website where I can find some examples of BCP views in PLSQL using instead of triggers.
Thanks a lot.
Regards
Faiz
Email : [email protected]Frank
Hi Frank,
Thanks for your reply. I am sorry I should have made my question more clearer. BCP is a term which we keep using in our project , it means Business Component Views. And this is a view created on the database side much like our traditional views. ADF or the user interface inserts into the database through this view. You are right ADF does not bind to PLSQL directly so all this is being handled at the user interface level but for the final insert into the database views, its being done using the Buisiness component views.
So do u have any examples which use this approach.
Thanks a ton !!
Regards
Faiz
Email : [email protected] -
Error: Attribute binding invalid for tag ganttChart according to TLD
Hi,
I am experimenting with writing my first custom tag and getting the stack trace:
org.apache.jasper.JasperException: /GanttFaces.jsp(18,3) Attribute binding invalid for tag ganttChart according to TLD
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:234)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:989)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:710)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
when using a binding with my custom tag:
<jg:ganttChart binding="#{ganttFaces.ganttChart}" id="gantt1" .... >
The error message reads as if I have to make special considerations in the TLD file to enable binding, but I can't find anything about that. Thats how my tld file looks:
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>JGantt</shortname>
<uri>http://netronic.de/jgantt/taglibJSF</uri>
<info>My tag library </info>
<tag>
<name>ganttChart</name>
<tagclass>de.netronic.jgantt.server.jsf.JGanttChartTag</tagclass>
<info>The chart</info>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
Any idea what I am missing?
UdoIn your TLD, I do not see any binding attribute! you ahe to define it
<attribute>
<name>binding</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
Afterwards, you should create the setter method in your tag class: setBinding(String binding) -
NullPointerException was thrown while extracting a value from an instance
Dear all,
We have got a null point exception during commit call. According to the stack trace shown below, it seems that it is a problem due to instance variable accessor. As we know toplink use reflection to access the instance variable value. I am curious whether the exception we got is related to any class-loader setting. Thanks a lot.
=================
Stack Trace:
Exception [TOPLINK-69] (OracleAS TopLink - 10g (9.0.4.5) (Build 040930)): oracle
.toplink.exceptions.DescriptorException
Exception Description: A NullPointerException was thrown while extracting a valu
e from the instance variable [versionID] in the object [com.oocl.csc.frm.pom.tes
t.model.Company].
Internal Exception: java.lang.NullPointerException
Mapping: oracle.toplink.mappings.DirectToFieldMapping[versionID-->COMPANY.VERSIO
NID]
Descriptor: Descriptor(com.oocl.csc.frm.pom.test.model.Company --> [DatabaseTabl
e(COMPANY)])
at oracle.toplink.exceptions.DescriptorException.nullPointerWhileGetting
ValueThruInstanceVariableAccessor(DescriptorException.java:1022)
at oracle.toplink.internal.descriptors.InstanceVariableAttributeAccessor
.getAttributeValueFromObject(InstanceVariableAttributeAccessor.java:68)
at oracle.toplink.mappings.DatabaseMapping.getAttributeValueFromObject(D
atabaseMapping.java:304)
at oracle.toplink.mappings.DirectToFieldMapping.iterate(DirectToFieldMap
ping.java:355)
at oracle.toplink.internal.descriptors.ObjectBuilder.iterate(ObjectBuild
er.java:1438)
at oracle.toplink.internal.descriptors.DescriptorIterator.iterateReferen
ceObjects(DescriptorIterator.java:258)
at oracle.toplink.internal.descriptors.DescriptorIterator.startIteration
On(DescriptorIterator.java:407)
at oracle.toplink.publicinterface.UnitOfWork.discoverUnregisteredNewObje
cts(UnitOfWork.java:1368)
at oracle.toplink.publicinterface.UnitOfWork.discoverAllUnregisteredNewO
bjects(UnitOfWork.java:1290)
at oracle.toplink.publicinterface.UnitOfWork.assignSequenceNumbers(UnitO
fWork.java:326)
at oracle.toplink.publicinterface.UnitOfWork.collectAndPrepareObjectsFor
Commit(UnitOfWork.java:664)
at oracle.toplink.publicinterface.UnitOfWork.commitToDatabaseWithChangeS
et(UnitOfWork.java:1130)
at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(UnitOf
Work.java:956)
at oracle.toplink.publicinterface.UnitOfWork.commit(UnitOfWork.java:771)
====================
====================
Mapping Description:
<?xml version = '1.0' encoding = 'UTF-8'?>
<project>
<project-name>POM-TEST</project-name>
<login>
<database-login>
<platform>oracle.toplink.oraclespecific.Oracle9Platform</platform>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:@sjcngdb2:1521:cdrfrmdv</connection-ur
l>
<user-name>pomowner</user-name>
<password>BB742416276274A47F360CCDD2711570</password>
<uses-native-sequencing>false</uses-native-sequencing>
<sequence-preallocation-size>50</sequence-preallocation-size>
<sequence-table>SEQUENCE</sequence-table>
<sequence-name-field>SEQ_NAME</sequence-name-field>
<sequence-counter-field>SEQ_COUNT</sequence-counter-field>
<should-bind-all-parameters>false</should-bind-all-parameters>
<should-cache-all-statements>false</should-cache-all-statements>
<uses-byte-array-binding>true</uses-byte-array-binding>
<uses-string-binding>false</uses-string-binding>
<uses-streams-for-binding>false</uses-streams-for-binding>
<should-force-field-names-to-upper-case>false</should-force-field-names
-to-upper-case>
<should-optimize-data-conversion>true</should-optimize-data-conversion>
<should-trim-strings>true</should-trim-strings>
<uses-batch-writing>false</uses-batch-writing>
<uses-jdbc-batch-writing>true</uses-jdbc-batch-writing>
<uses-external-connection-pooling>false</uses-external-connection-pooli
ng>
<uses-external-transaction-controller>false</uses-external-transaction-
controller>
<type>oracle.toplink.sessions.DatabaseLogin</type>
</database-login>
</login>
<java-class>com.oocl.csc.frm.pom.test.model.Company</java-class>
<tables>
<table>COMPANY</table>
</tables>
<primary-key-fields>
<field>COMPANY.COMPANY_KEY</field>
</primary-key-fields>
<descriptor-type-value>Normal</descriptor-type-value>
<identity-map-class>oracle.toplink.internal.identitymaps.SoftCacheWeakI
dentityMap</identity-map-class>
<remote-identity-map-class>oracle.toplink.internal.identitymaps.SoftCac
heWeakIdentityMap</remote-identity-map-class>
<identity-map-size>100</identity-map-size>
<remote-identity-map-size>100</remote-identity-map-size>
<should-always-refresh-cache>false</should-always-refresh-cache>
<should-always-refresh-cache-on-remote>false</should-always-refresh-cac
he-on-remote>
<should-only-refresh-cache-if-newer-version>false</should-only-refresh-
cache-if-newer-version>
<should-disable-cache-hits>false</should-disable-cache-hits>
<should-disable-cache-hits-on-remote>false</should-disable-cache-hits-o
n-remote>
<alias>Company</alias>
<copy-policy>
<descriptor-copy-policy>
<type>oracle.toplink.internal.descriptors.CopyPolicy</type>
</descriptor-copy-policy>
</copy-policy>
<instantiation-policy>
<descriptor-instantiation-policy>
<type>oracle.toplink.internal.descriptors.InstantiationPolicy</ty
pe>
</descriptor-instantiation-policy>
</instantiation-policy>
<query-manager>
<descriptor-query-manager>
<existence-check>Check cache</existence-check>
</descriptor-query-manager>
</query-manager>
<event-manager>
<descriptor-event-manager empty-aggregate="true"/>
</event-manager>
<mappings>
<database-mapping>
<attribute-name>companyKey</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.COMPANY_KEY</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>contact</attribute-name>
<read-only>false</read-only>
<reference-class>com.oocl.csc.frm.pom.test.model.Contact</referen
ce-class>
<is-private-owned>false</is-private-owned>
<uses-batch-reading>false</uses-batch-reading>
<indirection-policy>
<mapping-indirection-policy>
<type>oracle.toplink.internal.indirection.NoIndirectionPoli
cy</type>
</mapping-indirection-policy>
</indirection-policy>
<uses-joining>false</uses-joining>
<foreign-key-fields>
<field>COMPANY.CONTACT_OID</field>
</foreign-key-fields>
<source-to-target-key-field-associations>
<association>
<association-key>COMPANY.CONTACT_OID</association-key>
<association-value>CONTACT.POID</association-value>
</association>
</source-to-target-key-field-associations>
<type>oracle.toplink.mappings.OneToOneMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>createdBy</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.CREATED_BY</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>creationClientID</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.CREATION_CLIENTID</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>creationTime</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.CREATION_TIME</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>employeeList</attribute-name>
<read-only>false</read-only>
<reference-class>com.oocl.csc.frm.pom.test.model.Person</referenc
e-class>
<is-private-owned>false</is-private-owned>
<uses-batch-reading>false</uses-batch-reading>
<indirection-policy>
<mapping-indirection-policy>
<type>oracle.toplink.internal.indirection.NoIndirectionPoli
cy</type>
</mapping-indirection-policy>
</indirection-policy>
<container-policy>
<mapping-container-policy>
<container-class>com.oocl.csc.frm.pom.impl.FWPersistentArra
yList</container-class>
<type>oracle.toplink.internal.queryframework.ListContainerP
olicy</type>
</mapping-container-policy>
</container-policy>
<relation-table>EMPLOYEMENT</relation-table>
<source-key-fields>
<field>COMPANY.COMPANY_KEY</field>
</source-key-fields>
<source-relation-key-fields>
<field>EMPLOYEMENT.EMPLOYER_KEY</field>
</source-relation-key-fields>
<target-key-fields>
<field>PERSON.POID</field>
</target-key-fields>
<target-relation-key-fields>
<field>EMPLOYEMENT.EMPLOYEE_ID</field>
</target-relation-key-fields>
<type>oracle.toplink.mappings.ManyToManyMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>lastUpdateClientID</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.LAST_UPDATE_CLIENTID</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>lastUpdatedBy</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.LAST_UPDATED_BY</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>lastUpdateTime</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.LAST_UPDATE_TIME</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>name</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.NAME</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>partner</attribute-name>
<read-only>false</read-only>
<reference-class>com.oocl.csc.frm.pom.test.model.Company</referen
ce-class>
<is-private-owned>false</is-private-owned>
<uses-batch-reading>false</uses-batch-reading>
<indirection-policy>
<mapping-indirection-policy>
<type>oracle.toplink.internal.indirection.NoIndirectionPoli
cy</type>
</mapping-indirection-policy>
</indirection-policy>
<uses-joining>false</uses-joining>
<foreign-key-fields>
<field>COMPANY.PARTNER</field>
</foreign-key-fields>
<source-to-target-key-field-associations>
<association>
<association-key>COMPANY.PARTNER</association-key>
<association-value>COMPANY.COMPANY_KEY</association-value>
</association>
</source-to-target-key-field-associations>
<type>oracle.toplink.mappings.OneToOneMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>persistentCtxt</attribute-name>
<read-only>false</read-only>
<reference-class>com.oocl.csc.frm.pom.impl.FWPOMPersistentContext
</reference-class>
<is-null-allowed>false</is-null-allowed>
<aggregate-to-source-field-name-associations>
<association>
<association-key>OWNERID</association-key>
<association-value>COMPANY.OWNERID</association-value>
</association>
<association>
<association-key>ROOTID</association-key>
<association-value>COMPANY.ROOTID</association-value>
</association>
</aggregate-to-source-field-name-associations>
<type>oracle.toplink.mappings.AggregateObjectMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>poid</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.POID</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>version</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.VERSION</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>versionID</attribute-name>
<read-only>false</read-only>
<field-name>COMPANY.VERSIONID</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
</mappings>
<type>oracle.toplink.publicinterface.Descriptor</type>
</descriptor>
</descriptors>
</project>
====================
====================
Session Creation Method:
SessionBroker broker = (SessionBroker) manager.getSession(brokerName, Thread.currentThread().getContextClassLoader());
broker.getLogin().getPlatform().getConversionManager().setLoader(Thread.currentThread().getContextClassLoader());
====================
===================
Class Hierarchy:
Object extends> ..xxx.. extends> FWObject extends> Company
The problematic attribute -- versionID -- is defined at "FWObject" level.
===================
===================
Environment Configuration:
Application Server version: 10.1.2
TopLink version : 9.0.4.5
TopLink classpath: specified at container level
FWObject classpath: specified at container level
Company classpath: specified at application level
===================
Thanks and regards,
WilliamDear All,
We have loaded the toplink.jar to container level instead of application level. Don't know whether it is a possible source of error. Moreover, what is the purpose of loading antlr.jar? What is this jar for?
Thanks and regards,
William -
Sample insert into table with BLOB column
This is my first opportunity to work with BLOB columns. I was wondering if anyone had some sample code that shows the loading of a blob column and inserted into the table with a blob column.
I have to produce a report (including crlf) and place it into a blob column. The user will download the report at a later time.
Any suggestions / code samples are greatly appreciated!!!!You can enable string binding in TopLink.
login.useStringBinding(int size);
or you could enable binding in general,
login.bindAllParameters();
Maybe you are looking for
-
Pass parameter from OnInitialisation to OnInputProcessing
Hi, I have asked this before but I closed that thread and awarded all the points. I'm still having trouble with it, so I post it again for clarification. I have a BSP, a.bsp in the Page Attributes I have a parameter error1 which is a string with the
-
Changing a folder's icon...having problems.
I just got a Mac, so I'm new to the OS for the most part. I'm trying to customize my desktop, namely change the icon for for a folder. The icon I want to use is the icon for a program called soulseeX. I searched around the forum, and saw the unanimou
-
Essbase Error - 1270040 Data load buffer [2] does not exist
When building dimension for ASO cube, it keeps giving me this error message. Do I need to activate or increase the Data Load Buffer when building dimenions manually (not using MaxL)? It allows me to build part of the dimensions using about 100 record
-
Unmanaged Servers in WLS 10?
Hi all, I'm in the very early stages of developing a new web application. My company currently has several applications running on WLS 8.1, and we're using this new application as a proof-of-concept for upgrading to WLS 10. My development box is runn
-
I have read the authorize and deauthozie section in support. I understand how to deactivate all computers. All I want to do is deactive one iphone so I can transfer songs to a new iphone I have. Can someone please help me out with this? Thanks