Using callStoredProcedure / callStoredFunction though a library/Class
Jdev 11.1.1.3.0
I been using callStoreProdure /call StoreFunction as explained in fusion middleware guide http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvgen.htm#insertedID5. It works perfectly fine.
As, i have to call the above methods many place at Entity level / View level so i would like to bundle them into a library / class file and using them through the library rather pasting the meothd in all instance where i need them.
If i try to create a class file containing the above method then it could not resolve getDBTransaction(). With my y limited knowledge of Java i am clue less.
protected Object callStoredFunction(int sqlReturnType, String stmt,
Object[] bindVars) {
CallableStatement st = null;
try {
//1. Create a JDBC CallableStatement
st =
getDBTransaction().createCallableStatement("begin ? := " + stmt + "; end;",
0);
//2. Register the first bind variable for the return value
st.registerOutParameter(1, sqlReturnType);
if (bindVars != null) {
//3. Loop over values for the bind variables passed in if any
for (int z = 0; z < bindVars.length; z++) {
//4. Set the value of user-supplied bind vars in the stmt
st.setObject(z + 2, bindVars[z]);
//5. Execute the statement
st.executeUpdate();
//6. Return the value of the first bind variable
return st.getObject(1);
} catch (SQLException e) {
throw new JboException(e);
} finally {
if (st != null) {
try {
//7.Close the statement
st.close();
} catch (SQLException e) {
e.printStackTrace();
thanks
best regards
Sanjay Chatterji
Sanjay,
Just create a custom base class for your EO/VO (this processes is also described in the fusion developer's guide) and put the method in there.
John
Similar Messages
-
Problem: my J2EE ear file uses the AdventNet third-party library to do
SNMP work. WebLogic Server 8.1 also uses this AdventNet third-party
library to do its own SNMP work. The problem is the version used by
WebLogic 8.1 is older than the version I use, so my code tries to run
and finds the wrong version of the library that WebLogic 8.1 has supplied.
Possible solution: I plan to have a custom classloader (derived from
java.lang.ClassLoader) that gets hooked in to my threads using
Thread.setContextClassLoader(). This custom classloader would look for
the AdventNet library jars in a spot I specify so it would find the
correct ones. Since I want to change the usual classloader behavior of
"look in parent classloaders first, then child classloader" to "look in
child classloader first, then in parent classloaders" I can't just
override ClassLoader.findClass(). I, at a minimum, have to override
ClassLoader.loadClass() to look in my classloader first. I have
questions about this:
1. What other methods do I have to override? For example, which of the
resource-related methods do I need to override so that resources are
searched for first in my classloader then in parent classloaders?
2. I was thinking of using a URLClassLoader as a helper to my
classloader, invoking its method(s) from my custom classloader's
method(s) to actually load the classes from URLs that are not on the
standard classpath. I was planning to set it up with a custom parent
classloader that can't find anything, so that the helper URLClassLoader
would only ever find classes/resources in the URLs I provide to it. Does
this approach make sense? Have you seen anything like this done before?
3. Is there any way around this problem besides a custom ClassLoader? A
buggy custom ClassLoader would have problems which AFAIK would be
difficult to track down as ClassLoader problems.
Thanks in advance for any help you can provide.Alvin wrote:
Hi,
I am experiencing the same problme and
even I tried to put the AdventNet jar files
before weblogic.jar I still cannot get it
to work
Would you help me out here.
Thanks,
-AlvinI finally figured out a way to do it using a custom classloader that
looked in the directory where I kept the version of AdventNet I wanted
before looking in the normal places classloaders look.
How it works is I hook two classloaders at the bottom of the chain of
classloaders. My custom BlockingClassLoader is hooked as a child of the
normal chain of classloaders, then a URLClassLoader is hooked under
that. The BlockingClassLoader's findClass method checks if the class
starts with a package prefix I want to control (like "com.adventnet.").
If it does, then it acts like it can't find the class. This makes its
child, the URLClassLoader, try to find the class. The URLClassLoader
is given the URL of places to look for classes that match the directory
I keep the version of AdventNet I want in. When I load a class, I
directly tell the URLClassLoader to load it so that it is loaded as I want.
There's more to it than this. I had to override some other methods in
my BlockingClassLoader and do some other stuff. I'm not sure if I can
share the source code, as it was developed on company time and thus is
owned by the company. Feel free to ask questions though.
I haven't tried this solution very long (basically just unit tested it)
but it looks promising. -
For many years, I have maintained a library of often used functions for C++. This has become more challenging with the required namespace for C#.
Is there a way to use a namespace, such as "Library", and have a program with a different namespace include the Library namespace?
bhs67You could create a class X in a namspace Y in a C# class library project. You can then add a reference to this class library project/assembly from every application in which you intend to use the class X in namespace Y.
You don't add references to namespace, you add references to assemblies in .NET. You can then use a class in namespace Y of any referenced assembly by adding a using directive at the top of the code file in which you reference the class:
using Y;
Please remember to close your threads by marking helpful posts as answer. -
Using OCCI with Oracle XA Library
Is it possible to use OCCI with Oracle XA Library?
the XA function xaoSvcCtx() can returns the OCI service handle
for a given XA connection. but how to convert it to the OCCI
Connection class?
any comments would appreciate
RayHi Ravi,
We are now building CORBA application with C++. some programs
manage transaction through Transaction service(a TM of X/OPEN
DTP architecture), these programs must use XA Library.
OCCI is a wonderful tool for C++ programer,with OCCI building
a persistent layer over ORACLE is very simple.
But if OCCI not work with XA we have no choice but PRO*C or
OCI ,which's actually C style tool and hard to use especially
in object mode.
So we hope OCCI can provide this feature in next release. and
I beleive This feature is necessary,It's very common using a
transaction monitor such as ORACLE Application Server .
regards,
Ray -
If I build a Tag-library class on Weblogic 5.1, and subsequentially update
and recompile it; how can I get WebLogic 5.1 to use this updated .class? I
don't want to continually stop and start the service... any ideas?
I figured it out. Under the Configuration/TagLibraries,
create a CrossTagAttr folder and stick a .vtm file in it. In the
.vtm file, use the <crosstag_attributes> tag and its
children. See Configuration/TagLibraries/CrossTagAttr/Spry/Spry.vtm
for an example. -
Hi everyone,
I deleted my itunes library (after backing up to my time machine) to download a large torrent, now i want to restore my itunes library to my MBA from time machine but its saying there is not enough room on my MBA even though the library is 22GB and there is 27GB free on my MBA??Here's something else to consider:
Since Snow Leopard, OS X uses a Decimal count for file size. iTunes however still uses a Binary count. What that means is: your iTunes library shows one size, while the folder shows another. Depending on the size of your library, this can be a pretty big difference.
Yours won't be that much, but it may be enough to prevent it from moving to the MBA from the TM. -
Where are C++ Standard Library Classes for Unicode RFC SDK?
I have the Unicode RFC SDK and there is a document (sapucdoc.htm) that explains that the C++ standard library classes have SAP_ equivalents. For example:
string --> SAP_string
It then says that header files for these classes are named SAP<standard lib name>.hpp. So for the string class:
string.h --> SAPstring.hpp
The rfcsdk/include directory does not contain any of the header files. Where can I find these header files and possibly libraries I need to use the standard C++ libraries with this version of the RFC SDK?
Thanks.Those icons are not accessible directly.
Try setting the appropriate button type, like following code uses "info light" type to show the "i" icon.
{cod}
UIButton *aboutButton=[UIButton buttonWithType: UIButtonTypeInfoLight];
{code} -
I loaded iTunes on a new laptop. I copied and pasted my albums to a 4G stick and down loaded them to the new laptop. Placing them in, Libraries – Music – iTunes and than in Itunes used File – add file to library. So far so good. For what ever reason one of the CDs would not load onto the stick. I got the orginal CD and loaded directly to Itunes. Now when I look in Libraries – Music – iTunes it’s not there but it is in and plays in iTunes. What should I have done or should I be doing? Thanks.
It's not a unique situation - happens all the time, smaller hard drives getting filled up.
It's also easy to fix. I just moved my itunes content to a bigger hard drive.
First I made a backup of the itunes database file - iTunes Library.itl. Just in case anything went wrong.
Nothing did go wrong, but I'd have it in case anything DID go wrong. That file holds ratings, playcounts, Date Added, and other metadata.
Second, in itunes change the preferences > advanced tab to tell itunes to put everything on G:
Set the itunes folder location to something like G:Media or G:iTunes
This will affect all FUTURE additions to itunes and not do anything to the existing locations.
Make sure the checkbox for "Keep itunes organized" is NOT checked. I also left the "Copy files when adding" unchecked.
Third, to move all the files to G: without itunes losing the paths, run the File > Library > Organize > Consolidate command. This will need to run a while, so be patient as it copies all the files to the new G: location. This does NOT delete the originals. You will have to do that.
Fourth, make sure everything in itunes is OK and you can play stuff in your library. If you're really cautious you can run a script to check for missing/dead tracks. -
I have a Ipod Nano and want to get another one , and use both. Can I use the same computer and library for both?
Yes
-
My partner and I share the powerbook and I use my iPad, Though we each log in with separate accounts all my pics and music are in both libraries . Can I isolate accounts from iCloud ?
Not quite sure exactly what you want to do, but you cannot do it on a PowerBook. iCloud requires Lion and Lion requires an Intel MacBook or MacBook Pro.
-
Use OBJCLASS object of Emigall for Class & characteristics creation in FL
Hi Fritz,
Good day,
I want to use OBJCLASS object of Emigall for
Class and characteristics cration of Functional Location, The object is
desiged for Equipment only,
I read the document of this object which says
that it can be modify to use for functional location as well by changing
some rule, I tried by changing the field "Name of database table for
object" from the standard which is made for DEVICE/EQUIPMENT
I need your help to modify the rule to use this object for class and
characterstic creation for Functional Location, the migration object field is set to Device
which I want to change to FUNCLOC but that field is not modifiable.
Can you help me Fritz
Regards,
RobertRobert,
Yes you are right. The following changes have to be made:
HEADER-OBJECT_TYPE need to be set to IFLOT (Fixed Value or Transfer field rule)
DATA-FIELD need to be set to TPLNR (Fixed Value or Transfer field rule)
DATA-VALUE need to be set to either CONNOBJ or DEVLOC (Via KSM field rule)
Kind regards,
Fritz -
Using external drive for iTunes Library
There's about 80G of music on my external hard drive. I'd like to use this music as the library when the external is connected to the laptop. I don't know how to make this work. I know it's possible to duplicate the music on the Powerbook and create another library on the HD. But what I'm looking to do is have the laptop library separate from the HD and to manually choose which is being used. The problem is getting the mac to create a library of the 80G of music stored on the HD.
Any replies greatly appreciated.
Powerbook G4 Mac OS X (10.4.8)It's no different than creating any new iTunes library. Since you already have an iTunes Library file that you want to keep, rename that file...something like iTunes Laptop Library. Then hold down the Option key while opening iTunes and choose "Create Library" when presented with the option. iTunes will create a new iTunes Library file in the iTunes folder, and it will be empty. Use the Add command or drag-and-drop the external HD music folder to populate this new library. When you close iTunes, you might want to rename this new library file also, so the two library files, which can coexist peacefully side by side, are easy to distinguish from each other.
Whenever you want to switch from using one library to the other, just hold down the Option key when opening iTunes, select Choose Library, and select the other library file.
iMac G4 17; iBook G4 1.33 Mhz 14; iPod 3G 20GB Mac OS X (10.3.9) -
I have just downloaded the latest itunes version (11.0.1). All my data cannot now be located, though the library is showing all the correct content.The data is stored on an external hard drive. How do I tell the library where to find it's data?
The iTunes application should be installed on the system drive. You may need to repair iTunes to fix that error regarding a missing .exe.
To organize your library properly see Make a split library portable.
If you don't have a working version of the library that can be transformed into a portable shape I have tools and techniques that can repair the broken links.
tt2 -
How do I use a variable from an Interface class?
Right now I have three classes. First class is called Game and it extends my second class call Parent and also implements my third class call Source. Source is an interface class. I have a variable that I want to use in my Source class named Checker. Now, How do I go among using that variable from my Game class? What should the code look like?
ex.
public class Game extends Parent implements Source
need help badly....ok, what I forgot to tell you guys is that my variable
in my interface class is a boolean type(true or
false). It is set to true now. But I want it to change
to false when a user triggers a button in the Game
class. How do I do this? You don't because you can't. If you have a varaible declared in an interface it must be static and final. It cannot, therefore, be changed. Better head back to the drawing board. -
Bridge will not now let me use camera raw, though I have been using it every day. It ways that "the parent application is not active. Bridge requires that a qualifiying product has been launched at least once to enable this feature." What am I to do?
Usually this points to having some kind of earlier trial version still installed on your system. However without more details you are not likely to find an answer. Try this for a start:
How To Get Help Quickly
Maybe you are looking for
-
photo shop editor wont open doesnt work
-
Strategey to Delete Millions/Move millions of rows in a database
Hello, I am using SQL Server 2012 SE. I am trying to delete rows from a couple of tables (GetPersonValue has 250 million rows and I am trying to delete 50Million rows and GetPerson has 35 Million rows and I am trying to delete 20 million rows). These
-
Script for Free Space in Datafiles
Hi Got the below script from metalink [130866.1] to identify free space within a data file.Couple of questions 1)Is dba_Free_Space an exact indicator of how much space is available in a file. 2) What is the significance of using blocks in vs using by
-
Connecting G5 with Sony Trinitron Only---Problems
I am running MediaCentral on my Powermac G5 to turn it into a media center. All I want to do is connect my Sony Trinitron to the G5. I bought the comosite/S-Video adapter from Apple. However, when I plug in my TV, I get absolutely no picture on the s
-
Good morning. I have several (4 different) email addresses imported into my imac mail program. I have gone through the settings and configured the program to best of my ability. I have set one email address as my default account. For some reason when