Public static BookDB instance() - java book store

hi, can some one explain what is the use of instance function. ( the code is from sun's Duke bookstore example )
public static BookDB instance () {
if (onlyInstance == null)
onlyInstance = new BookDB();
return onlyInstance;
thanks..

hello,baalaji
This is a "singleton" design pattern.
This pattern will make sure there is no more than one instance of BookDB class in the JVM.
I am sure that you do not display another important phrase of codes---construction method. Have a look at this method, there must be:private BookDB(){
} This private construction method makes sure no one could new an instance of this class through a "new" keywords. The only method can new an instance is through BookDBinstance()!
Good luck and enjoy Java!
Wang Yu
Developer Technical Support
Sun Microsystems
http://sun.com/developers/support

Similar Messages

  • How to store a RSA pair key in Java Key Store (jks) and VS

    Hi Everyone ,
    I have generated a RSA pair key . now I need to store my public key in a Java Key Store (.jks file) . and then I need to read this .jks file in another application and get this public key to use for verification .
    I'll appreciate it if anyone could help me with this matter with a sample code for import/export public key to/from a java key store file or any hints.
    Best Regards,
    Vivian

    I don't think this makes sense. How have you generated an RSA key pair and where is the result stored?

  • How to call java with public static void main(String[] args) throws by jsp?

    how do i call this from jsp? <%spServicelnd temp = new spServicelnd();%> does not work because the program has a main. can i make another 2nd.java to call this spServiceInd.java then call 2nd.java by jsp? if yes, how??? The code is found below...
    import java.net.MalformedURLException;
    import java.io.IOException;
    import com.openwave.wappush.*;
    public class spServiceInd
         private final static String ppgAddress = "http://devgate2.openwave.com:9002/pap";
         private final static String[] clientAddress = {"1089478279-49372_devgate2.openwave.com/[email protected]"};
    //     private final static String[] clientAddress = {"+639209063665/[email protected]"};
         private final static String SvcIndURI = "http://devgate2.openwave.com/cgi-bin/mailbox.cgi";
         private static void printResults(PushResponse pushResponse) throws WapPushException, MalformedURLException, IOException
              System.out.println("hello cze, I'm inside printResult");
              //Read the response to find out if the Push Submission succeded.
              //1001 = "Accepted for processing"
              if (pushResponse.getResultCode() == 1001)
                   try
                        String pushID = pushResponse.getPushID();
                        SimplePush sp = new SimplePush(new java.net.URL(ppgAddress), "SampleApp", "/sampleapp");
                        StatusQueryResponse queryResponse = sp.queryStatus(pushID, null);
                        StatusQueryResult queryResult = queryResponse.getResult(0);
                        System.out.println("Message status: " + queryResult.getMessageState());
                   catch (WapPushException exception)
                        System.out.println("*** ERROR - WapPushException (" + exception.getMessage() + ")");
                   catch (MalformedURLException exception)
                        System.out.println("*** ERROR - MalformedURLException (" + exception.getMessage() + ")");
                   catch (IOException exception)
                        System.out.println("*** ERROR - IOException (" + exception.getMessage() + ")");
              else
                   System.out.println("Message failed");
                   System.out.println(pushResponse.getResultCode());
         }//printResults
         public void SubmitMsg() throws WapPushException, IOException
              System.out.println("hello cze, I'm inside SubmitMsg");          
              try
                   System.out.println("hello cze, I'm inside SubmitMsg (inside Try)");                         
                   //Instantiate a SimplePush object passing in the PPG URL,
                   //product name, and PushID suffix, which ensures that the
                   //PushID is unique.
                   SimplePush sp = new SimplePush(new java.net.URL(ppgAddress), "SampleApp", "/sampleapp");
                   //Send the Service Indication.
                   PushResponse response = sp.pushServiceIndication(clientAddress, "You have a pending Report/Request. Please logIn to IRMS", SvcIndURI, ServiceIndicationAction.signalHigh);
                   //Print the response from the PPG.
                   printResults(response);
              }//try
              catch (WapPushException exception)
                   System.out.println("*** ERROR - WapPushException (" + exception.getMessage() + ")");
              catch (IOException exception)
                   System.out.println("*** ERROR - IOException (" + exception.getMessage() + ")");
         }//SubmitMsg()
         public static void main(String[] args) throws WapPushException, IOException
              System.out.println("hello cze, I'm inside main");
              spServiceInd spsi = new spServiceInd();
              spsi.SubmitMsg();
         }//main
    }//class spServiceInd

    In general, classes with main method should be called from command prompt (that's the reason for main method). Remove the main method, put the class in a package and import the apckage in your jsp (java classes should not be in the location as jsps).
    When you import the package in jsp, then you can instantiate the class and use any of it's methods or call the statis methods directly:
    <%
    spServiceInd spsi = new spServiceInd();
    spsi.SubmitMsg();
    %>

  • Help required in understanding of static blocks in java

    Hi ,
    Can some one help me in understanding the difference between static blocks in java....also what is the difference in declaring some static variables in a class and and declaring some variables in a static block? From an architecture viewpoint when should one use static blocks in Java?

    Static blocks are piece of code that can beexecuted
    before creating an instance of a class.static blocks are executed once, when the class
    itself is loaded by the JVM. They are not executed
    before creating each instance of a class.
    For example whatever you include in the mainn method will be
    executed without you having to create the instanceof
    the class using the new operator. So you can saythe
    main method is a static block.main is not a static initialisation block but a
    static method. a special case static method at that -
    it is only executed when the containing class is
    specified as a parameter to the JVM. (unless you
    specifcally call it elsewhere in code - but that
    would be bad form).
    in answer to the original post, static variables
    belong to the class. each instance of the class share
    the same static variables. Public static vars can be
    accessed by prefixing them with the class name. A
    static initialisation block can be used to
    initialise static variables. Variables declared
    within the static initialisation block exist only
    within the scope of the block.
    e.g.
    public class Foo {
    static Bar bar;        // static member variable
    // static initialisation block
    static {
    // variable declared in static block...
    String barInfo =
    arInfo = System.getParameter("barInfo");
    // ... used to initialise the static var
    bar = new Bar(barInfo);
    So is the only purpose of static initialization blocks is to initialize static variables? Does the initialization of static variables inside a static block make any difference in performance? If yes , then how ?

  • Why ..we have to use this ? public static void ? please !

    hi ...im ibrahim ..and im new here in java nd new in the forum too ...nd please i would like to know ...why
    do we use the method
    public static void main (String []args)
    i mean why ..static nd why public ..why void ....why main ..nd why (string []args)
    ...why we use it ...always ....hopefully ..im looking for a very clear answer to this ...issue ..?
    please help .......!

    public - this is the visibility modifier (it means that the body method can be call by any outside method)
    static - the method is a static instance of the class. Not sure what exactly it does though.
    void - this is the return type. void means that the method returns nothing.
    main - the name of the method. It can be anything.
    "public static void main" - this is the main method where upon executing the Java program the Java Virtual Machine will try to locate this method within the specifies class to be executed. This is always the first one to run when executing a Java program. None of this word may be changed or the program cannot be run.

  • Static class variable doesn't store ?

    Hi,
    I'm a beginner in java.
    I defined a static class variable (nodes) in th following code :
    public class MySOMapp extends javax.swing.JFrame {
         private static final long serialVersionUID = 1L;
         private static SOMTrainer trainer;
         private static SOMLattice lattice;
         private static SOMNode nodes;
         private static Hashtable nwordf; 
         public MySOMapp(String args[]) {
              SOMNode nodes = new SOMNode();          //.....But a method of this class, nodes comes null. methos definition :
    private void makesame() {I don't understand why the nodes is null in makesame method which is in the same class with nodes ?
    thanks,
    Yigit

A: static class variable doesn't store ?

thankyou. I solved the problem. But why static fields
are not good idea ? How can i get rid of these...Remove the static word :) Seriously, try to develop a technique to get swiftly out of the static main method. Like this:
class MyClass {
    MyClass() {
        // Your code here instead of in main method.
    public static void main(String[] args) {
        new MyClass();
}

thankyou. I solved the problem. But why static fields
are not good idea ? How can i get rid of these...Remove the static word :) Seriously, try to develop a technique to get swiftly out of the static main method. Like this:
class MyClass {
    MyClass() {
        // Your code here instead of in main method.
    public static void main(String[] args) {
        new MyClass();
}

  • Non-static version of java.lang.Thread.dumpstack?

    hi,
    it would be useful sometimes to have a graphical debug panel on an application I'm working on which shows the active threads and allows further information to be shown if wanted - the problem is that I can't find an API call to get the current stack dump of an arbitrary thread - does anyone know if this is possbile somehow without a full debug environment?
    java.lang.Thread.dumpstack would be ideal if only it were an instance method..
    thanks,
    asjf

    what's the probelm? you call this in the threads class
    and each thread (object) executes this statement and
    therefore prints its stacktrace ...ok - here is some mocked up (and plain wrong in terms of the tree model's consistency over sequential method calls) code that shows what I'd like to achieveimport java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    import javax.swing.event.*;
    public class JThreadExp extends JPanel {
       JTree tree;
       JTextArea jta;
       public JThreadExp(TreeModel model) {
          super(new GridLayout(1,2,4,4));
          tree = new JTree(model);
          jta = new JTextArea();
          add(tree);
          add(jta);
          tree.addTreeSelectionListener(new TreeSelectionListener() {
             public void valueChanged(TreeSelectionEvent e) {
                PrintStream stderr = System.err;
                String msg=null;
                try {
                   TreePath tp = e.getPath();
                   System.out.println(tp.getLastPathComponent());
                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
                   PrintStream ps = new PrintStream(new BufferedOutputStream(baos, 1024*1024));
                   System.setErr(ps);
                   Thread t = (Thread) tp.getLastPathComponent();
                   try {
                      t.dumpStack();
                   } catch(Throwable ee) {}
                   ps.close();
                   jta.setText(baos.toString()); //newXML.toString());
                } catch(Exception e2) {
                   msg = e2.getMessage();
                System.setErr(stderr);
                if(msg!=null)
                   System.out.println(msg);
       public static void main(String[]arg) throws Exception {
          JFrame frame = new JFrame("JThreadExp");
          JThreadExp jte;
          final ThreadModel tm = new ThreadModel();
          frame.getContentPane().add(jte = new JThreadExp(tm));
          frame.pack();
          frame.setVisible(true);
          final JTree tree = jte.tree;
          new Thread(new Runnable() {
             public void run() {
                try {
                   while(true) {
                      TreeModelEvent tme = new TreeModelEvent(this, new Object [] {tm.getRoot()});
                      for(Iterator i = tm.listeners.iterator(); i.hasNext(); )
                         ((TreeModelListener) i.next()).treeStructureChanged(tme);
                      Thread.sleep(5000);
                      new Thread(new Runnable() {
                         public void run() {
                            try { Thread.sleep(50000); } catch(Exception e) {e.printStackTrace();}
                      } ).start();
                } catch(Exception e) {
                   e.printStackTrace();
          } ).start();
    class ThreadModel implements TreeModel {
       public boolean isLeaf(Object node) { return (node instanceof Thread); }
       public Object getRoot() {
          ThreadGroup uppermost = Thread.currentThread().getThreadGroup();
          while(uppermost.getParent()!=null)
            uppermost = uppermost.getParent();
          return uppermost;
       public Object getChild(Object p, int i) {
          Object result = "<unavailable>";
          if(p instanceof ThreadGroup) {
             ThreadGroup parent = (ThreadGroup) p;
             ThreadGroup[] tg = new ThreadGroup[parent.activeGroupCount()];
             Thread[] t = new Thread[parent.activeCount()];
             parent.enumerate(tg, false);
             parent.enumerate(t, false);
             if(i<tg.length)
                result = tg;
    else if(i<tg.length+t.length)
    result = t[i-tg.length];
    return result;
    public int getChildCount(Object node) {
    int result = 0;
    if(node instanceof ThreadGroup) {
    ThreadGroup parent = (ThreadGroup) node;
    ThreadGroup[] tg = new ThreadGroup[parent.activeGroupCount()];
    Thread[] t = new Thread[parent.activeCount()];
    result += parent.enumerate(tg, false);
    result += parent.enumerate(t, false);
    return result;
    public int getIndexOfChild(Object parent, Object child) {
    for(int i=0; i<getChildCount(parent); i++) {
    if(getChild(parent,i).equals(child))
    return i;
    return -1;
    Set listeners = new HashSet();
    public void addTreeModelListener(TreeModelListener l) {
    listeners.add(l);
    public void removeTreeModelListener(TreeModelListener l) {
    listeners.remove(l);
    public void valueForPathChanged(TreePath path, Object newValue) { // this shouldn't be called - Tree is not editable
    System.out.println("valueForPathChanged");
    } The problem is that I'd like to obtain a reference to a Thread object (which I haven't written the code for) and get a (vaguely accurate if not exact) stack dump from it.
    I'll have a look over JDB in the meantime thanks :)
    thanks,
    asjf

  • Static or Instance methods

    Hi,
    I am a self-taught Java programmer and have been writing Java code over the past 18 months. I am comfortable with general coding, but I am having great difficulty deciding whether a method should be static or instance.
    In many cases, I decide to create a class which has maybe 1 or 2 methods. A good example of this is the class I wrote which allows me to pass it a JFrame and it then centres the JFrame on screen. Seems to me I can do 1 of 2 things.
    1. Put the code in the class constructor and then call it with:
    CentreMe cm = new CentreMe(this);
    where CentreMe is the name of the class and this refers to the JFrame that is being passed
    2. Put the code in a static method within the class and then call it with:
    CentreMe.CenterFrame(this);
    Assuming that all the CentreMe class does is to centre a frame in this way, which is the correct (or at least best) approach. Seems to me there is no point in creating objects as per option 1 when they are never used therafter?
    If anyone has advice or a URL that deals with this particular "design" issue I would be very grateful.
    Thanks
    Mark

    Given that design, then your intuition is correct, that method should be static. No need for objects there. But on a higher level, the design is backwards. Instead of having a separate class that knows how to centre a JFrame, it would be better to create a subclass of JFrame that knows how to centre itself. Have a look at Bruce Eckel's online book "Thinking in Java" ( http://www.bruceeckel.com ); it has a lot of useful information about the design of objects.

  • What is public static int??

    hi everybody,
    I am attending data structure and alogrithms class ...i wanna know about all, so which book can I read to understand.
    Also in java what is the meaning of
    "public static int"....
    it have got "return" what is the meaning it ??
    best regards
    blazer

    Perhaps you should try the Java forums and not the Sun Ray forum :)

  • Java compiler contradicts Java book

    NOW this is a big surprise...One of the Java book says "If a static member of the class, singleton in the ex below, is PUBLIC, the client (HelloUser in this case) can still access the static member even if the client is not in the same package" . I tried it but got the following error - singleton can't be accessed outside the package ? Any clues ?
    import learn.*;
    public class HelloUser {
        public static void main(String args[])
         Object obj[] = {new Integer(11), new Character('A')};
         Hello.print(obj);
         singleton.GetSingleton().print();
    package learn;
    class singleton {
        private static int mX;
        private singleton(int x) {mX = x;}
        private static singleton sSingle = new singleton(10);;
        public static singleton GetSingleton() {
         print();
         return sSingle;
        public static void print()
         System.out.println("Val: " + mX);
    }

    No, the book is not wrong just not quite complete. It should have stated that other classes in the same package have access ...OK, let's complete the original statement using your suggestion :
    An object of a class with package access can be created by any class inside the package but not outside the package. However, if a static member of that class is public, the client programmer can still access that static member from withn the same package even though they can't create an object of that class.
    Does this make any sense? No.

  • Convertion of class variable (static) into instance variable(non-static)!

    Dear all,
    got a slight different question.
    Is that possible to convert class variable (static) into instance variable(non-static)?
    If so, how to make the conversion?
    Appreciating your replies :)
    Take care all,
    Leslie V
    http://www.googlestepper.blogspot.com
    http://www.scrollnroll.blogspot.com

    JavaDriver wrote:
    Anything TBD w.r.to pass by value/reference (without removing 'static' keyword)?Besides the use of acronyms in ways that don't make much sense there are two other large problems with this "sentence".
    1) Java NEVER passes by reference. ALWAYS pass by value.
    2) How parameters are passed has exactly zero to do with static.
    Which all means you have a fundamentally broken understanding of how Java works at all.
    Am I asking something apart from this?
    Thanks for your reply!
    Leslie VWhat you're asking is where to find the tutorials because you're lost. Okay. Here you go [http://java.sun.com/docs/books/tutorial/java/index.html]
    And also for the love of god read this [http://www.javaranch.com/campfire/StoryPassBy.jsp] There is NO excuse for not knowing pass-by in Java in this day and age other than sheer laziness.

  • Neccessity of Public Static.

    My Warm Hello to Everyone Out there,
    I am absolutely New to Java. Absolutely. I am astonished by the pure beautiful advances made to the paradigm of C++, that created this enormous Programming language.
    Well I understand for the Most common example: "Example.java" Program that one may find in most of the books, as the starting program for the Life in Java...
    class Example{
        public static void main(string args[]){
            // body of main
    }In Which "Example". can this main() be anything else: private or protected?
    If no Why not?
    :: DreamyDinesh ::

    It seems that Java's Initial Versions might have been doing something else. It looks as if either, this
    method of sandwitching the main() inside a Class (whose nomenclature, is not 2 b ignored) was followed
    out of experience or it was well planned then, brought into action.It was ever thus. The JLS (Java Language Specification) has always specififed that a program's main
    is to be public and static, but some earlier versions of Sun's JVM didn't check for that public modifier,
    so one could thrill to having their private mains executed. The current JVMs do check for this.

  • How can i pass the values to method public static void showBoard(boolean[][

    I need x and y to pass to the method
    public static void showBoard(boolean[][] board
    i am very confused as to why its boolean,i know its an array but does that mean values ar true or false only?Thanks
    import java.util.Random;
    import java.util.Scanner;
    public class Life1
         public static void main(String[] args)
              int x=0;
              int y=0;
              Scanner keyIn = new Scanner(System.in);
              System.out.println("Enter the first dimension of the board : ");
              x = keyIn.nextInt();
              System.out.println("Enter the second dimension of the board : );
              y = keyIn.nextInt();
              boolean[][] board = new boolean[x][y];
              fillBoard(board);
              showBoard(board);
              //Ask the user how many generations to show.
              board = newBoard(board);
              showBoard(board);
         //This method randomly populates rows 5-9 of the board
         //Rewrite this method to allow the user to populate the board by entering the
         //coordinates of the live cells.  If the user requests that cell 1, 1 be alive,
         //your program should make cell 0,0 alive.
         public static void fillBoard(boolean[][] board)
              int row, col, isAlive;
              Random picker = new Random();
              for(row = 4; row < 9; row++)
                   for(col = 4; col < 9; col++)
                        if (picker.nextInt(2) == 0)
                          board[row][col] = false;
                        else
                          board[row][col] = true;
         //This method displays the board
         public static void showBoard(boolean[][] board)
              int row, col;
              System.out.println();
              for(row=0; row < x; row++)
                   for(col=0; col<y; col++)
                        if (board[row][col])
                             System.out.print("X");
                        else
                             System.out.print(".");
                   System.out.println();
              System.out.println();
         //This method creates the next generation and returns the new population
         public static boolean[][] newBoard(boolean[][] board)
              int row;
              int col;
              int neighbors;
              boolean[][] newBoard = new boolean[board.length][board[0].length];
              makeDead(newBoard);
              for(row = 1; row < board.length-1; row++)
                   for(col = 1; col < board[row].length-1; col++)
                        neighbors = countNeighbors(row, col, board);
                        //make this work with one less if
                        if (neighbors < 2)
                             newBoard[row][col]=false;
                        else if (neighbors > 3)
                             newBoard[row][col] = false;
                        else if (neighbors == 2)
                             newBoard[row][col]= board[row][col];
                        else
                             newBoard[row][col] = true;
              return newBoard;
         //This method counts the number of neighbors surrounding a cell.
         //It is given the current cell coordinates and the board
         public static int countNeighbors(int thisRow, int thisCol, boolean[][] board)
              int count = 0;
              int row, col;
              for (row = thisRow - 1; row < thisRow + 2; row++)
                   for(col = thisCol - 1; col < thisCol + 2; col++)
                     if (board[row][col])
                          count++;
              if (board[thisRow][thisCol])
                   count--;
              return count;
         //This method makes each cell in a board "dead."
         public static void makeDead(boolean[][] board)
              int row, col;
              for(row = 0; row < board.length; row++)
                   for(col = 0; col < board[row].length; col++)
                        board[row][col] = false;
    }

    this is what im workin with mabey you can point me in the right directionimport java.util.Random;
    /* This class creates an application to simulate John Conway's Life game.
    * Output is sent to the System.out object.
    * The rules for the Life game are as follows...
    * Your final version of the program should explain the game and its use
    * to the user.
    public class Life
         public static void main(String[] args)
              //Allow the user to specify the board size
              boolean[][] board = new boolean[10][10];
              fillBoard(board);
              showBoard(board);
              //Ask the user how many generations to show.
              board = newBoard(board);
              showBoard(board);
         //This method randomly populates rows 5-9 of the board
         //Rewrite this method to allow the user to populate the board by entering the
         //coordinates of the live cells.  If the user requests that cell 1, 1 be alive,
         //your program should make cell 0,0 alive.
         public static void fillBoard(boolean[][] board)
              int row, col, isAlive;
              Random picker = new Random();
              for(row = 4; row < 9; row++)
                   for(col = 4; col < 9; col++)
                        if (picker.nextInt(2) == 0)
                          board[row][col] = false;
                        else
                          board[row][col] = true;
         //This method displays the board
         public static void showBoard(boolean[][] board)
              int row, col;
              System.out.println();
              for(row=0; row < 10; row++)
                   for(col=0; col<10; col++)
                        if (board[row][col])
                             System.out.print("X");
                        else
                             System.out.print(".");
                   System.out.println();
              System.out.println();
         //This method creates the next generation and returns the new population
         public static boolean[][] newBoard(boolean[][] board)
              int row;
              int col;
              int neighbors;
              boolean[][] newBoard = new boolean[board.length][board[0].length];
              makeDead(newBoard);
              for(row = 1; row < board.length-1; row++)
                   for(col = 1; col < board[row].length-1; col++)
                        neighbors = countNeighbors(row, col, board);
                        //make this work with one less if
                        if (neighbors < 2)
                             newBoard[row][col]=false;
                        else if (neighbors > 3)
                             newBoard[row][col] = false;
                        else if (neighbors == 2)
                             newBoard[row][col]= board[row][col];
                        else
                             newBoard[row][col] = true;
              return newBoard;
         //This method counts the number of neighbors surrounding a cell.
         //It is given the current cell coordinates and the board
         public static int countNeighbors(int thisRow, int thisCol, boolean[][] board)
              int count = 0;
              int row, col;
              for (row = thisRow - 1; row < thisRow + 2; row++)
                   for(col = thisCol - 1; col < thisCol + 2; col++)
                     if (board[row][col])
                          count++;
              if (board[thisRow][thisCol])
                   count--;
              return count;
         //This method makes each cell in a board "dead."
         public static void makeDead(boolean[][] board)
              int row, col;
              for(row = 0; row < board.length; row++)
                   for(col = 0; col < board[row].length; col++)
                        board[row][col] = false;
    }

  • Confuse in Chapter 25 Persistence in the Web Tier's example book store.

    Hi all,
    I'm confusing about the example in Chapter 25 Persistence in the Web Tier.
    the book store example creates the bookdbao in contextlistener
    BookDBAO bookDBAO = new BookDBAO(emf);
    context.setAttribute("bookDBAO", bookDBAO);and the bookdbao's constructor like this.
        public BookDBAO(EntityManagerFactory emf) throws Exception {
            try {
                em = emf.createEntityManager();
            } catch (Exception ex) {
                throw new Exception(
                        "Couldn't open connection to database: " + ex.getMessage());
        }and the servler get bookdbao like
    BookDBAO bookDBAO = (BookDBAO) getServletContext().getAttribute("bookDBAO");so if many users access the servlet at the sametime,
    they all get the same bookDBAO,
    but i think em is not guaranteed to be threadsafe.
    so the example is not thread-safe, is it?
    thanks

    Hi all,
    I'm confusing about the example in Chapter 25 Persistence in the Web Tier.
    the book store example creates the bookdbao in contextlistener
    BookDBAO bookDBAO = new BookDBAO(emf);
    context.setAttribute("bookDBAO", bookDBAO);and the bookdbao's constructor like this.
        public BookDBAO(EntityManagerFactory emf) throws Exception {
            try {
                em = emf.createEntityManager();
            } catch (Exception ex) {
                throw new Exception(
                        "Couldn't open connection to database: " + ex.getMessage());
        }and the servler get bookdbao like
    BookDBAO bookDBAO = (BookDBAO) getServletContext().getAttribute("bookDBAO");so if many users access the servlet at the sametime,
    they all get the same bookDBAO,
    but i think em is not guaranteed to be threadsafe.
    so the example is not thread-safe, is it?
    thanks

  • JDev 3.2 Deployment wizard failed to show public static methods in step #3.

    JDeveloper 3.2 and 3.1 Deployment Wizard ( step #3) does not show any public static methods being deployed as Java stored procedures. The "settings" button is disabled.
    Is this a demo version of the tool ?

    It's probably easier to add them all and remove the ones you don't want. Admittedly this is a bit cumbersome, because the 3.2 navigator doesn't allow multiple selection..
    (one area that's much better in 9i :) )
    Brian

  • Maybe you are looking for