The CustomDatumExample.java only works if the Employee object has 2 attributes.

The CustomDatumExample.java only works
if the Employee object has 2 attributes -
(EmpName and EmpNo). If I try to add
another attribute to the Employee object I get java.lang.ArrayIndexOutOfBoundsException: 2 on the getAttr3 method.
Anyone know why? Thanks.
Employee object
CREATE TYPE employee AS OBJECT
(empname VARCHAR2(50), empno INTEGER,
attr3 VARCHAR2(50));
Custom object class
public class Employee implements CustomDatum, CustomDatumFactory
public static final String SQLNAME = "EMPLOYEE";
public static final int SQLTYPECODE = OracleTypes.STRUCT;
MutableStruct _struct;
static int[] _sqlType =
12, 4
static CustomDatumFactory[] _factory = new CustomDatumFactory[3];
static final Employee _EmployeeFactory = new Employee();
public static CustomDatumFactory getFactory()
return _EmployeeFactory;
/* constructor */
public Employee()
struct = new MutableStruct(new Object[3], sqlType, _factory);
/* CustomDatum interface */
public Datum toDatum(OracleConnection c) throws SQLException
return struct.toDatum(c, SQL_NAME);
/* CustomDatumFactory interface */
public CustomDatum create(Datum d, int sqlType) throws SQLException
if (d == null) return null;
Employee o = new Employee();
o._struct = new MutableStruct((STRUCT) d, sqlType, factory);
return o;
/* accessor methods */
public String getEmpname() throws SQLException
{ return (String) _struct.getAttribute(0); }
public void setEmpname(String empname) throws SQLException
{ _struct.setAttribute(0, empname); }
public Integer getEmpno() throws SQLException
{ return (Integer) _struct.getAttribute(1); }
public void setEmpno(Integer empno) throws SQLException
{ _struct.setAttribute(1, empno); }
public String getAttr3() throws SQLException
{ return (String) _struct.getAttribute(2); }
public void setAttr3(String attr3) throws SQLException
{ _struct.setAttribute(2, attr3); }
}

You also need to add an appropriate element to the _sqlType array.
In practice, it is easiest to have JPublisher regenerate the CustomDatum class when you have changed your object type definition:
jpub -user=scott/tiger -sql=EMPLOYEE:Employee

Similar Messages

  • TS1381 The X key only works when the shift key is depressed

    The X key only works when the shift key is depressed.  can only type capital

    I have this same issue with the Letter L.  I can ony type it with a captiaL L.  The Lowercase L does not work in Safari, but works in other programs.
    This suggestion did not work for me.

  • Previewing mp3's in the preview panel only works for the first 3 seconds

    When i click on an mp3 to preview in the panel it only plays the first few seconds or so. How can I fix this?

    My appologies. I have a Win 7 PC. Adobe Bridge CC . Yes all the files work on other players. And bridge will actually play wav and af files fine, but it wont play mp3's past a few seconds. It says it's playing in the preview pannel but the audio cuts out.

  • I purchased a new vehicle with a USP port but my nano model A199 will not work, only works with the aux plug which will not allow me to view the songs on the vehicle touchscreen. Is there a download I can get to put into this nano?

    I purchased a new vehicle and the older ipod nano I have will not work through the USP  port, only works through the aux plug. Is there a download i can get toput into the nano that will then allow me to use the USP port instead of the aux port?

    Check with your dealer and see if there is a special cable available for connecting your iPod. It should have a dock connector on one end and USB and miniplug on the other.

  • Iphone 4: Home Button Not Working. The home button only works when it is connected to iTunes, once i disconnet it does not work, i have tried a restore to factory settings but it still is not working. Any suggestions?

    iphone 4: Home Button Not Working. The home button only works when it is connected to iTunes, once i disconnet it does not work, i have tried a restore to factory settings but it still is not working. Any suggestions?

    Apple, as I said, does not repair your iPhone. All hardware service issues are handled by replacing the unit. So they can't handle the home-button issue without also addressing the issue of the cracked screen, for which they'll almost certainly charge you. But you can make an appointment at an Apple Store or call Apple tech support and plead your case.
    Regards.

  • With my i phone 4 , the Push notifications doesn't work for apps like (fb viber , whatsapp etc ) it only works for the official apps like message  even when im using the phone, has  this probleme with the iOs 6.0.1 and also with the iOs 6.1

    With my i phone 4 , the Push notifications doesn't work for apps like (fb viber , whatsapp etc ) it only works for the official apps like message  even when im using the phone, has  this probleme with the iOs 6.0.1 and also with the iOs 6.1

    This isn't an issue. Notice the screen prior to the one that shows usage has an iCloud section and a Manage Storage button. For this button to activate ios needs to download a few kb from icloud. Switching back to this screen forces ios to download those few kb.

  • Recently I was working on my home Network and lost my Password for my Home wireless connection. After many attempts, I remembered the password and was able to get in. Now the MacBook Pro only works at home on a Hard wire connection. I have an additional 9

    Recently I was working on my home Network and lost myPassword for my Home wireless connection. After many attempts, I remembered thepassword and was able to get in. Now the MacBook Pro only works at home on aHard wire connection. I have an additional 9 devices on the same network, allare functioning properly. The Air connection works fine at any other Networksout side the Home connection. I did a PRAM reset, deleted the Network profileand rebuilt in System Preferences. Still unable to connect wireless on Homenetwork. Any Ideas?

    I seem to have fixed it by putting <div  class="clearfloat"></div> after the navigation bar?

  • I don't know what's wrong with my camara it's all black and the front only works not the back

    I don't know what's wrong with my camara it's all black and the front only works not the back

    Try This...
    Close All Open Apps... Sign Out of your Account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...

  • I have an iPod Video. (30GB 5th gen) The headphone jack only works if I push the headphone cable input to one side and hold it t here. If I leave it alone it either doesnt play at all or I hear a crackling sound. Any suggestions? Thanks.

    I have an iPod Video. (30GB 5th gen) The headphone jack only works if I push the headphone cable input to one side and hold it t here. If I leave it alone it either doesnt play at all or I hear a crackling sound. Any suggestions? Thanks.

    There are threads ongoing on similar topics. This is not a suitable topic for this forum.
    I will pass on any comments from the other threads and original post in this one, but I'm closing this topic and any further petitions like this as it will just result in "Creative-bashing" and unproducti've comments.
    Cat

  • Infopath submit button only works for the first row in a repeating table‏

    Hi, I have a InfoPath Email submit button issue I could not figure out. I have a master/detail repeating table in my form, and one of fields is "EmailAddress" which shows customer's email address. I created a submit button and put the "EmailAddress"
    field to "TO" object. When I tested it, the submit button only would return the first row of emailaddress from the repeating table, but not the rest of it..
    What I want is when I highlighted a customer, and click the submit button, the current customer's email address would show up in "TO" list. I did some research and saw some suggestions about using current() function. So I put current() in the front,
    like this:
    current()/dfs:dataFields/d:vw_HZLeadLists/@EmailAddress
    Still not working..Just return the first record of emailaddress from master repeating table... Does anyone know what's going on here? Thanks a lot!

    Hello,
    Use double eval to get all rows values. See my reply for more information in below thread:
    eval(eval(EmailAddress, 'concat(ToField, ";")'), "..")
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/cc22aeb7-351f-45a7-8a4c-94132c3e0db2/eval-semicolon-function-issue?forum=sharepointcustomizationprevious
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Flash Player only works for the account that downloaded it

    I downloaded flash player and did not specify any special preferences, however, it doesn't work for the 2 other accounts on the computer.  It only runs for the Administrator account from which i downloaded it. I'm running XP professional. Can someone tell me how to fix this?

    hi, i had already deleted cookies, temp internet files, etc;
    i only have the IE pop up blocker and blocking level set at Medium;
    it's the latest version of FP 10.0.45.2.
    I installed this version a couple of weeks ago and it worked ok for all accounts (the other 2 accounts are not admin) for a week. Then, it stopped working for all accounts, i reinstalled it (some trial and error involved), then when it finally reinstalled, only works for the one account. i just tried to reinstall from one of the other accounts and error mssg said  "failed to register"
    Date: Sun, 6 Jun 2010 11:20:59 -0600
    From: [email protected]
    To: [email protected]
    Subject: Flash Player only works for the account that downloaded it
    Hi ol, I would go to Tools, click on Internet Options and clear the Temp files. Delete Cookies, Delete Files, including the off line content. I would do this using all accounts. Also check the history files while you are there and delete those also unless you have done so recently.
    What version of Flash Player do you have Installed?
    Do you use any adblock or pop up blocker software?
    Thanks,
    eidnolb
    >

  • Hi i want to unlock my iphone 4s to use it in jordan , i have bought it from cousin and the phone is only work on verizon please help me to unlock it

    hi i want to unlock my iphone 4s to use it in jordan ,
    i have bought it from cousin
    and the phone is only work on verizon please help me to unlock it

        Hi there, ronyme! Thanks for reaching out about your iPhone 4s. It's a great device. I can see you bought it from your cousin. Have you already taken possession of it? If so, are you in the United States or have you taken the device to Jordan or another country?
    DionM_VZW
    Follow us on Twitter www.twitter.com/vzwsupport

  • Including image in SharePoint survey answer and hiding elements only work on the first page

    Hi All,
    I would like to add some text/remove some text etc on a sharepoint survey page.
       Which i have done using jquery/jscript.
    But unfortunately it only works on the first page.
    Any ideas how i can get it to work on all the pages?
    See a sample here on how you can add the scripts:
        http://sharepointkings.blogspot.com.au/2011/05/include-image-in-sharepoint-survey.html
    Cheers

    Hi Patrick, does the first page use the same ASPX file as the other pages? If not, you will need to add your jquery/jscript to the other page as well.
    Dimitri Ayrapetov (MCSE: SharePoint)

  • Drop support only works on the second drop

    Hi,
    I created an ImageComponent that accepts drops and displays images. The problem I'm facing is that the drop is only accepted on the second try. For some reason the getDataFlavors() method on the TransferSupport returns an empty array on the first drop.
    I'm dropping a JPG file from the desktop on my ImageComponent. I'm running it in debug mode with the latest version of Eclipse on Mac OS X 10.6.
    I hope someone can help me solve this problem.
    Thanks in advance,
    Stef
    Here is my source code:
    public class ImageComponent extends JComponent {
         private static final long serialVersionUID = 1L;
         private BufferedImage image;
         private final Vector<ImageChangeListener> listeners = new Vector<ImageChangeListener>();
         public ImageComponent() {
              setTransferHandler(new ImageTransferHandler());
         public synchronized void addImageChangeListener(ImageChangeListener listener) {
              listeners.add(listener);
         public synchronized void removeImageChangeListener(ImageChangeListener listener) {
              listeners.remove(listener);
         public void setImage(BufferedImage image) {
              this.image = image;
              paint(getGraphics());
         @Override
         public Dimension getPreferredSize() {
              if (image != null) {
                   BufferedImage scaledImage = Utils.scaleImage(image, getWidth(), getHeight());
                   return new Dimension(scaledImage.getWidth(), scaledImage.getHeight());
              } else {
                   return super.getPreferredSize();
         @Override
         public void paint(Graphics g) {
              if (g != null) {
                   g.clearRect(0, 0, getWidth(), getHeight());
                   super.paint(g);
                   if (image != null) {
                        BufferedImage scaledImage = Utils.scaleImage(image, getWidth(), getHeight());
                        int x = ((getWidth() - scaledImage.getWidth()) / 2);
                        int y = ((getHeight() - scaledImage.getHeight()) / 2);
                        g.drawImage(scaledImage, x, y, null);
         private void fireImageChange() {
              ImageChangeEvent event = new ImageChangeEvent(this, image);
              for (ImageChangeListener listener : listeners) {
                   listener.imageChanged(event);
              setImage(image);
         private class ImageTransferHandler extends TransferHandler {
              @Override
              public boolean canImport(TransferSupport support) {
                   for (DataFlavor dataFlavor : support.getDataFlavors()) { // Returns an empty array on the first drop
                        System.out.println(dataFlavor);
                   return support.isDataFlavorSupported(DataFlavor.javaFileListFlavor); // returns false on the first drop, true on consecutive drops
              @Override
              public boolean importData(TransferSupport support) {
                   if (canImport(support)) {
                        BufferedImage newImage = readFirstImage(support);
                        if (newImage != null) {
                             setImage(newImage);
                             fireImageChange();
                             return true;
                        } else {
                             return false;
                   } else {
                        return false;
              private BufferedImage readFirstImage(TransferSupport support) {
                   try {
                        List<File> fileList = (List<File>) support.getTransferable().getTransferData(
                                  DataFlavor.javaFileListFlavor);
                        if (fileList != null && fileList.size() > 0) {
                             File file = fileList.get(0);
                             return ImageIO.read(file);
                        } else {
                             return null;
                   catch (IIOException exception) {
                        return null;
                   catch (IOException exception) {
                        exception.printStackTrace();
                        return null;
                   catch (UnsupportedFlavorException exception) {
                        return null;
                   catch (Exception e) {
                        return null;
    }

    I'm on a relatively new system, where I haven't set much up, but I don't get any package-name completion which highlights the point that this is shell (and shell config) dependent.  What shell are you using?  Have you done anything to configure completion?  Do you have any pacman related aliases (or functions)?
    I do, by default bash settings it seems, get filename completion with pacman -R, so the options are files in the current directory.
    EDIT: (duh) just installing bash-completion now - new results momentarily - but more on point, this further highlghts the shell + config dependent nature of this.  EDIT2: works as expected with bash-completion installed.
    Last edited by Trilby (2013-07-15 21:58:12)

  • I have a touchscreen laptop running Windows 8.1. Is it possible to use the touchscreen with Firefox? I've installed Firefox but it only works with the mouse etc

    have a touchscreen laptop running Windows 8.1. Is it possible to use the touchscreen with Firefox? I've installed Firefox but it only works with the mouse etc

    Hello Sirving575, sorry but the metro version of firefox has been cancelled, see : https://blog.mozilla.org/futurereleases/2014/03/14/metro/
    thank you

Maybe you are looking for

  • Using sql query with parameter

    OK, I can't find any docs on this. I can insert a parameter, but how do I insert that into the sql query?

  • The system could not determin a business area for item 00010

    i m getting bellow message while entering stock (MB1C).... No business area can be deermined for item 000010 Diagnosis : The System could not determine a business area for imte 000010. The item has plant (G001) 7 is assigned to company N001 for which

  • New Keyboard Shortcuts in Word 2010 NOT SAVING

    I am unable to save new keyboard shortcuts to Word 2010.  The ones that come with the program work like CTRL B for bold, etc., but when I try to create new ones, they'll work while I'm in Word, but when I try to close it for the day, it tells me that

  • PHP & ORACLE Connectivity on Solaris

    Hi all, You can check this site for PHP and Oracle connection tutorial. It is intended to installing Apache and PHP with Oracle support and connecting and using Oracle via PHP. Page URL : http://gokmen.selcuk.edu.tr/tutor/orasol/ociphp.php Additional

  • My 3rd gen/ my wifes and windows

    Not sure how much of this is important. I have had my IPod since Feb. It was working normally the last time I synced. My wife got one last week, has a seperate windows loging and apple id. I tried to sync today and two things happend. 1. It reconized