How do java classes handle searches?

how do java classes store information? and how do I get it out again?
I am a relational programmer who has decided 2 take a detour in object oriented lands.
In a relational table you store info and u get the information out through a (my)SQL query
now how does a class Project with instance project 1,2,3,.........
get the information from a project with a certain name?
eg:
projectid: 1
responsible: 1234 (<--userid)
projectname: testproject
projectid: 2
responsible: 1256
projectname: leukproject
projectid: 3
responsible: 1483
projectname: testproject
projectid: 4
responsible: 3245
projectname: darnedproject
and so on....
so lets say our class Project has a thousend instances. I want to search by name, how do i write the onces to the screen who have name "testproject"?
So how do i do this without sqlquerys, totally oop?
any help would be very much appreciated! :?

Hi NiQuil,
Let me tell you a few basic things. First, RDBMS and OOP are quite different things.
In RDBMS, you ask ur database, "hey, I want this piece of info. Get me that". But you
don't tell it how to go and search for it, right. Well, things are not as simple as that in
OOP. Here you have to specify how to get your data also. But Java will surely help you
to make it easier.
First of all, you should not map between tables (of RDBMS) and classes (of OOP),
although certainly you can do this in some crude ways. What you have to do is, put all
your projects in a single instance, and then using a method, query that instance. There
are numerous ways for querying. Several classes like Hashtable, Vector, Collection
etc etc helps you to store, search and retrieve data. But I dont think it is necessary or
helpful to describe these in detail here.
However, I would like to tell you one important point. OOP is not just about data storage
and retrieval. OOP is a way of thinking. It allows you to combine your data and operations
on it. An object is just a combination of data and operations on that data. Other objects
access this data only through an interface defined by these operations. Once you
understand this concept, life will be easier. But it takes some time, especially because
you come from RDBMS, a world which talks just about data.

Similar Messages

  • How do Java Class Objects get invalid?

    How do Java Classes get invalid in the database?

    What version of Oracle?
    Oracle provided or user created?
    Generally speaking if you modify the database objects a class depends on you can invalidate the object which in turn can invalidate dependend code/objects.
    More specifics are needed if you need a better response.
    HTH -- Mark D Powell --

  • How to java class

    This is my first time learning Java, Please show me how to write the Java Class which is connect to Main Class.
    Thanks a lot

    Go to http://java.sun.com/docs/books/tutorial/index.html and read the "Your First Cup Of Java" article. It will walk you through all the steps.
    If you're working in Linux then go here http://www.linuxnewbie.org/nhf/intel/programming/javaintro1.html and this article will explian the same thing for a Linux environment.

  • How does Java API handles binary files

    I couldn't find some documentation which describes how to extend the Java API for handling binary files. (I want to upload, check in/out (and delete) such files from within a Java application.) Does anybody know where I can find an example or some related documentation?
    TIA, Olaf

    The methods on ContentObjectDefinition
    allow you to create binary or ascii document content.

  • How run java class on Mac Os X

    i develope java appliction and run it on windows platform and now i need run it on Mac Os X but i am new user for Mac Os X and i dont know how i can open Unix shell to compile and run my classes and i dont need to use any tool to make this task.
    thanks
    rabab

    The Terminal Application is in Utilities in Applications. You can use this to open your Unix shell. From there, you should be able to compile and run your java applications.

  • Documentation or Blog on using java classes in idm

    Hi all,
    I am new to this environment. And i would like to know how to use the java methods in rules, and how write java classes for customised purpose.
    i.e writing the ones using the IDM provided package
    such as getting users from session cache, and rest all ..........
    Is there any documentaion for it. Or any one's blog?
    Please help me out.
    Thankyou

    When you download IDM, the install package has a directory "RFE", you can find this information there.

  • Java class for Information Broadcasting

    Does anyone know what java class handles information broadcasting in 04s? Specifically, what class handle the batch execution of web templates and conversion to pdfs?
    Thanks.

    Hello,
    Information Broadcasting uses the same infrastructure as in 3.x version (as far I know)
    Regards, Karol
    SAP BI Development

  • How can i use JWSDP1.6 from Ant tool to convert .wsdl file into Java class

    Hi All,
    i m very new in the development field.plese help me...
    i have a .wsdl file and i have to make some modification in the file and return this file with build file used in Ant tool.
    means my requirement is to conver the .wsdl file into java class,modify it and convert back to wsdl file.how can i do it using JWSDP1.6 and Ant tool.
    thanks in advance...
    Vikram Singh

    lemilanais wrote:
    hello!
    I have developpe an animation with flash. before give it to othe person in order to use it, i would like to secure it by integrated a security module inside the software.Secure it from what? Being played? Copied? Deleted? Modified?
    Because, i am a java developper, i have choose Netbeans 6.1 to secure it.That has to be the most random thing I've read in some time.
    do you know how can i do to integrate my animation .swf inside my java class?Java can't play SWF files and Flash can't handle Java classes, so what you're suggesting here doesn't make a lot of sense.

  • How can I either move or view the source of a JAVA CLASS user object?

    I am using Oracle 8i and I have the following JAVA CLASS objects in my database. I need to move some of these objects to a different database.
    1) How can I do this?
    2) How can I view the JAVA source code since these are classes?
    My knowledge of Oracle is limited. I have searched and searched and I can't find the answer. Any help would be greatly appreciated
    SELECT object_name, object_type
    FROM user_objects
    WHERE object_type IN ('JAVA SOURCE', 'JAVA CLASS', 'JAVA RESOURCE')
    ORDER BY object_type, object_name;
    OBJECT_NAME OBJECT_TYPE
    /d082321a_DpsJarStaticFilename JAVA CLASS
    DirHelperStatic JAVA CLASS
    DirHelperStatic$1 JAVA CLASS
    DpsJar JAVA CLASS
    DpsJarException JAVA CLASS
    DpsJarStatic JAVA CLASS
    FilenameFilterImpl JAVA CLASS
    FtpClient JAVA CLASS
    FtpClient$InputStreamProxy JAVA CLASS
    FtpClient$OutputStreamProxy JAVA CLASS
    FtpClientStatic JAVA CLASS
    FtpException JAVA CLASS
    FtpReply JAVA CLASS
    FtpTest JAVA CLASS
    LoadXml JAVA CLASS
    LoadXmlStatic JAVA CLASS
    UrlFileUtils JAVA CLASS
    Utils JAVA CLASS
    dir JAVA CLASS
    Thanks,
    Brian

    The source far java class objects that are not derived from java source objects
    (which is the case here, and is typically the case, such as when one loads
    classes into the database using loadjava on a jar that contains only .class
    files) does not exist in the database (just as it does not exist in a jar which
    contains only .class files). So there is essentially no way to view the source, short of extracting the bytecodes and using some decompiling tool. I don't recall what methodologies exist for extracting bytecodes in 8i. As for transferring
    the classes to another database, the standard Oracle import/export tool can do this.

  • How to find the location of java class files at runtime?

    Does anyonw have an idea how to get the file name of a java class given the binary name?
    I mean how can I get the file name for my class myPackage.myClass?
    I am looking for a function which takes "myPackage.myClass" as input and returns
    "c:\\javaprojects\\myPackage\\myClass.class".
    I tried to do it with the LassLoader class but it did not work. Does anyone have an idea if the Java core API already has a function which does that?
    Thanks, Bernhard

    Hi ,
    It is a simple SAMPLE code , you think and build a logics to handle all classes.
    Try this sample, It doesn't handle the inner classes you put logic to handle the logics for inner classes.
    The inner class format is it contains the character $ in the File location but inside the code you put "." instedad of "$" you to find out or put trials.
    package pkg1;
    import java.io.* ;
    import java.util.* ;
    import java.util.zip.* ;
    public class ClsB {
         private static Vector clsPaths ;
         public static Vector getPaths() {
              if( clsPaths == null ) {
                   String paths = System.getProperty( "java.class.path" ) ;
                   // In linux or solarise use the following
                   // StringTokenizer st = new StringTokenizer( paths , ":\n" ) ;
                   StringTokenizer st = new StringTokenizer( paths , ";\n" ) ;
                   clsPaths = new Vector() ;
                   while( st.hasMoreTokens() ) {
                        String path = st.nextToken() ;
                        File f = new File( path ) ;
                        if( f.exists() ) {
                             try {
                                  f = f.getCanonicalFile() ;
                                  clsPaths.add( f ) ;
                             }catch( IOException ioe ) { }
              return clsPaths ;
         public static String findClassPath( String fullClassName ) {
              Vector v = getPaths() ;
              for( int i = 0 ; i < v.size() ; i++ ) {
                   File f = ( File ) v.get( i ) ;
                   String path = findIn( f , fullClassName ) ;
                   if( path != null )
                        return path ;
              return null ;
         static boolean isJar( File jar ) {
              if( jar.isDirectory() )
                   return false ;
              try {
                   ZipFile zf = new ZipFile( jar ) ;
                   return true ;
              } catch ( ZipException ze ) {
                   // It is not a jar file
                   // you handle this
              } catch ( IOException ioe ) {
                   ioe.printStackTrace() ;
              return false ;
         static String findIn( File dirOrJar , String clsName ) {
              if( isJar( dirOrJar ) ) {
                   // It is something different because the class inside the jar file
                   // Simply I return the jar file location and the entry name ,
                   // but you put action what you want
                   if( isInsideJar( dirOrJar , clsName ) ) {
                        // All archieve file using the path separator is '/'
                        return dirOrJar.getPath() + "!" + clsName.replace( '.' , '/' ) + ".class" ;
              } else {
                   File f = new File( dirOrJar , clsName.replace( '.' , File.separatorChar ) + ".class" ) ;
                   if( f.exists() ) {
                        return f.getPath() ;
              return null ;
         static boolean isInsideJar( File jar , String clsName ) {
              try {
                   ZipFile zf = new ZipFile( jar ) ;
                   // All archieve file using the path separator is '/'
                   ZipEntry ze = zf.getEntry( clsName.replace( '.' , '/' ) + ".class" );
                   return ( ze != null ) ;
              } catch ( ZipException ze ) {
                   ze.printStackTrace() ;
              } catch ( IOException ioe ) {
                   ioe.printStackTrace() ;
              return false ;
         public static void main(String[] args) {
              System.out.println( findClassPath( "pkg1.ClsB" ) );
              System.out.println( findClassPath( "pkg1.pkg2.ClsA" ) );
    }

  • Java Class not apearing in Java Algorithm Class Search

    Hi,
    I installed oracle CC&B 2.3.1, with SDK 2.2.0.12. I am trying to create new java class by copying an exiting one and modifying it to be used with algorithm (Adhoc Char Value Validation).
    Steps are as follows:
    1-Created file by copying the exiting file AdhocNumericValidationAlgComp_Impl.java and only changing the name of the class:
    public class AK_AdhocNumericValidationAlgComp_Impl
    extends AK_AdhocNumericValidationAlgComp_Gen
    File location :
    C:\spl\CCB23DEV\java\source\cm\com\splwg\base\domain\common\characteristicType\AK_AdhocNumericValidationAlgComp_Impl.java
    2-Run Artificat generator successfully , which generated the files:
    C:\spl\CCB23DEV\java\sourcegen\cm\com\splwg\base\domain\common\characteristicType\AK_AdhocNumericValidationAlgComp.java
    C:\spl\CCB23DEV\java\sourcegen\cm\com\splwg\base\domain\common\characteristicType\AK_AdhocNumericValidationAlgComp_Gen.java
    C:\spl\CCB23DEV\java\target\cm\com\splwg\base\domain\common\characteristicType\AK_AdhocNumericValidationAlgComp.class
    C:\spl\CCB23DEV\java\target\cm\com\splwg\base\domain\common\characteristicType\AK_AdhocNumericValidationAlgComp_Gen.class
    C:\spl\CCB23DEV\java\target\cm\com\splwg\base\domain\common\characteristicType\AK_AdhocNumericValidationAlgComp_Impl.class
    Still the class is not appearing in "Java Algorithm Class Search" when trying to add a new algorithm type referencing this java class.
    I tried restarting the Tomcat application server, still not appearing.
    Where did I go wrong about it?
    Thanks

    Tomcat was down when I deployed the changes. It seems tomcat cannot find implemented interface AdhocCharacteristicValueValidationAlgorithmSpot
    The full error shows how tomcat is looking for the interface:
    Full error:
    - 2011-07-07 12:34:28,681 [main] ERROR (support.context.ContextFactory) Cannot find algorithm spot: 'com.splwg.base.domain.common.characteristicType.AdhocCharacteristicValueValidationAlgorithmSpot' for Cobol extension
    com.splwg.shared.common.LoggedException: Cannot find algorithm spot: 'com.splwg.base.domain.common.characteristicType.AdhocCharacteristicValueValidationAlgorithmSpot' for Cobol extension
         at com.splwg.shared.common.LoggedException.raised(LoggedException.java:65)
         at com.splwg.base.support.context.ContextFactory.extendAlgorithmSpots(ContextFactory.java:291)
         at com.splwg.base.support.context.ContextFactory.loadManagedObjectForApplication(ContextFactory.java:203)
         at com.splwg.base.support.context.ContextFactory.buildContext(ContextFactory.java:106)
         at com.splwg.base.support.context.ContextFactory.buildContext(ContextFactory.java:90)
         at com.splwg.base.support.context.ContextFactory.createDefaultContext(ContextFactory.java:498)
         at com.splwg.base.web.startup.SPLWebStartup.initializeApplicationContext(SPLWebStartup.java:178)
         at com.splwg.base.web.startup.SPLWebStartup.contextInitialized(SPLWebStartup.java:63)
         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
         at org.apache.catalina.core.StandardService.start(StandardService.java:516)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:592)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    - 2011-07-07 12:34:28,713 [main] INFO (web.startup.SPLWebStartup) Shutting Down the JMX Connectors...
    - 2011-07-07 12:34:28,713 [main] INFO (web.startup.SPLWebStartup) JMX Connectors shutdown successfully
    - 2011-07-07 12:34:28,713 [main] INFO (web.startup.SPLWebStartup) Shutting Down the Application Context...
    - 2011-07-07 12:34:28,728 [main] INFO (web.startup.SPLWebStartup) Application Context shutdown successfully
    Any advise ?
    Thanks

  • How to set render true or false in java class

    Use case:
    i have a page in which i have one inputListOfValues attributes and two LOV .initial the LOV render attribute value is false .it means it show only one attribute in run time .inputListOfValues is content two value .suppose if first value A then the first LOV have to show and is it value is B then Second LOV have to show .i bind my LOV to class .but i do not know how to set render attribute at java class.

    <af:inputListOfValues label="Branch Name"
    popupTitle="Search and Result Dialog"
    id="ilov1"
    model="#{pageFlowScope.organizationLOV.param['bindings.Organization'].listOfValuesModel}"
    converter="#{pageFlowScope.organizationLOV.param['bindings.Organization'].convert['latinDesc']}"
    valueChangeListener="#{viewScope.salaryBenefitsReportForm.branchChange}"
    binding="#{viewScope.salaryBenefitsReportForm.branchName}"
    rendered="true" visible="false"/>
    <af:inputListOfValues label="Department Name"
    popupTitle="Search and Result Dialog"
    id="ilov2"
    model="#{pageFlowScope.objectLOV.param['bindings.Department'].listOfValuesModel}"
    converter="#{pageFlowScope.objectLOV.param['bindings.Department'].convert['latinDesc']}"
    valueChangeListener="#{viewScope.salaryBenefitsReportForm.departmentChange}"
    binding="#{viewScope.salaryBenefitsReportForm.departmentName}"
    rendered="true" visible="false"/>
    this is code in jsff .
    and class code are following
    public void reportBy(ValueChangeEvent valueChangeEvent) {
    String value=(String)valueChangeEvent.getNewValue();
    System.out.println(value);
    if(value.equals("Branch")){
    branchName.setVisible(true);
    departmentName.setVisible(false);
    AdfFacesContext.getCurrentInstance().addPartialTarget(branchName);
    AdfFacesContext.getCurrentInstance().addPartialTarget(departmentName);
    if(value.equals("Department")){
    departmentName.setVisible(true);
    branchName.setVisible(false);
    AdfFacesContext.getCurrentInstance().addPartialTarget(departmentName);
    AdfFacesContext.getCurrentInstance().addPartialTarget(branchName);
    }

  • WSDL generated from java class - how to include headers?

    I am using the servicegen ant task and generating a web service based on a java class. I would like to include a username and password in the soap header and read that info using a handler. I am able to get that working, but how do I get the auto-generated WSDL to include the username/password header information? Is there something that I have to do in the handler so that this information is included in the WSDL?
    Thanks,
    Mike

    I did do this and I got the following error when deploying to the Stand-alone OC4j:
    Operation failed with error:
    Error compiling
    :D:\h\cots\Oracle\JDeveloper10g10.1.3\j2ee\home\applications\DBOperationsWSApp-DBData-WS\WebServices: Error instantiating compiler: webservice artifact generation failed :oracle.j2ee.ws.common.tools.api.ValidationException : Exception declaration mismatch between Implementation: dbdatapackage.DBDataOperations and Interface: dbdatapackage.DBDataWS. Impl class Method: getData declares exceptions not declared by the interface (java.lang.Exception)
    I am quite sure what it is saying. It generated the code for the Interface: dbdatapackage.DVDataWS. Impl class. Why would it not do it right? What expection is it complaining about? java.lang.Exception?

  • How to use URL class to execute a java class/app  on a remote machine?

    I am a beginner in Java networking and have a question about URL programming.
    How do I pass parameters to a java class/application over the web and then cause it to execute ? I then want to get the result back from the clas/app. The class/app resides on a remote machine and the protocol used is "http" protocol. OR all this is not possible through the URL and related classes ?

    How do I pass parameters to a java class/application over the web and then cause it to execute ? Using the HTTP protocl you can either perform a GET where the parameters are in the URL or a POST where the data is sent to the server with the request.
    The server must be setup as a web server to execute code based ojn a HTTP request. Using a web server with a JSP which contains the code to execute is the simplest way to do this.
    I then want to get the result back from the clas/app. The output of the JSP becomes in the data returned by the HTTP request.
    I would suggest looking for example on google.
    http://www.google.co.uk/search?q=java+http+request+tutorial
    Another option is to use RMI. The integration is tighter but it does not use the HTTP protocol.

  • How to invoke a 6 parameter java class within jsp

    i have just begun to learned jsp and java recently, so have the question below:
    Situation:
    My boss asked me to do a project for doing online data mining.
    He requested the thing below:
    1. Write a webpage by jsp with some textfield or pull down meun to get the parameter for getting the opinion and the parameter needed for the java class.
    2. When the user click the buttom in the website, then the java class have to be invoked.
    Questions:
    1. ask i put the .java in the server, i can simply use cmd and type the following command:
    java -Xmx800M P05context 1 1 3 6 F01xyz.txt F10xyz.txt
    which F01xyz is the prepared text file for the java class to read and the F10xyz.txt is the output file generated by the P05context.class
    but i don't know how to invoke the P05context.class by jsp
    My boss have suggested me two ways to do this:
    a. write a java virtual class to execute the java program.
    but i don't know how to write.
    i think conceptualy will be like this :
    public class run_java
    public void run java(parameter1,parameter2....,parameter6)
    //run the cmd command
    //java -Xmx800M P05context 1 1 3 6 F01xyz.txt F10xyz.txt
    b. write a javabean in the jsp. and i have try to use this code(at the end of the message:
    but the tomcat server reply a internal error to me
    how cani do ?
    the jsp file-->
    <jsp:useBean id="test" scope="session" class ="P05context" />
    <html>
    <head></head>
    <body>
    <% test.P05context(1,1,3,6,F01xyz.txt,F10xyz.txt); %>
    </body>
    </html>

    I still don't see why the form (the origin of the request) has to be a JSP, As you say, it might be static but forms I've written have usually had some kind of menu framework arround them and other variables. Also if the input is invalid you usually want to re-present the form, with an error message and the fields pre-populated according to what the user put in before. That does require a JSP and you may as well use the same JSP for an empty, as for a rejected request.
    the response to the form should be handled by a servlet. Both is HTML, but the
    form is static, and the reply dynamic. Using the combination; a servlet to do the data processing and a JSP to format the results is more flexible in a number of ways. For example, suppose you find the need to present the data form in, say, Greek? You don't want the processing to be duplicated in English and Greek versions of the results JSP.
    Suppose the boss wants to turn a graphics designer loose on your HTML. Don't want him mucking about with your processing code do you.
    The servlet typically takes the function of controller in the model/view/controller paradigm.
    Code in a servlet is cleaner, better formatted and easier to access with a debugger.

Maybe you are looking for