Generating database tables from Java classes

Hi,
I've encountered a number of tools which will create Java classes from database tables (e.g. JDeveloper has this functionality, Abator provides this for iBATIS, etc...).
However, I've not been able to locate any tools that perform the opposite job - i.e. given a Java class, it generates a database table (or, presumably, some SQL).
It's been suggested to me that Hibernate might provide this sort of capability, but if anybody has any experience of doing this, in any tool, I'd be interested to hear about it.
Thanks,
Alistair.

Many thanks for the pointers.
duffymo: I've taken a look at Middlegen (http://boss.bekk.no/boss/middlegen/index.html) but it seems that the first step is to specify the database schema, whereas I'm looking to generate the schema from existing code. Or have I missed something?
Alistair.

Similar Messages

  • Generate database tables from Business Components

    Is it possible to generate the database tables from a set of existing business components?
    This would be a handy feature to have, similar with JPA tables generation based on Entity Beans.
    Thanks
    Florin Marcus

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dmitri:
    Dear Laura,
    I mean first variant where the database would be the same:
    scott/tiger@database1
    foo/bar@database1
    Of course I understand that we must register every user in database by "CREATE USER XXX" and it is unacceptable for Internet. But it may be very convenient for an Intranet because we can build access restriction based on set of views without any changes in applications.
    Best wishes,
    Dmitri.<HR></BLOCKQUOTE>
    null

  • Generate XML Schema from Java classes?

    Hi,
    Considering an XML Mapping, i would like to generate a default XML Schema from my Java class.
    Is there a tool in toplink (10.1.3) to do that or does anyone have an easy way to generate this XML schema?
    Thanks,
    Ludovic

    Hi Ludovic,
    We don't have support for schema generation from Java classes in TopLink 10.1.3. It's required for JAXB 2.0 so it will be available in a future release.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                           

  • Create database tables from an xsd

    Is it possible to generate database table from a given xsd using toplink ?
    I want to use these tables to persist java objects obtained by unmarshalling the xml (corresponding to this xsd).
    Thanks in advance,
    Mahima

    Hello Mahima,
    Although you could use TopLink to generate a database schema from an XSD using a combination of wizards available in the TopLink Workbench, the resulting database schema would probably not be an optimal design. If you're interested we can talk about how to use this approach as a guide.
    Is your main use case the generation of a database schema or the actual movement of database data to/from XML?
    Using a combination of TopLink's object-relational and object-XML support to move data between XML and a relational database is a valid pattern. Refer to the discussion thread below for some approaches at setting up the metadata.
    TopLink-JAXB : Creating and Mapping tables from Toplink-JAXB POJOs.
    -Blaise

  • How to Create adf table from java bean

    Hi,
    How to Create adf table from java class (Not from ADF BC).
    Thanks
    Satya

    @vlsn -- you have to follow what shay said.
    Do the following in Model layer ::
    create a table property java class with your columns setters and getters like :
    *public class gridProps {*
    private int sno;
    private String orderNum;
    *public void setSno(int sno) {*
    this.sno = sno;
    *public int getSno() {*
    return sno;
    *public void setOrderNum(String orderNum) {*
    this.orderNum = orderNum;
    *public String getOrderNum() {*
    return orderNum;
    Create another table java class which will populate the values to your column values and return the collection :
    *public class gridPopulate {*
    private  List<gridProps> gridValues ;
    *public List<gridProps> setToGrid(ArrayList<ArrayList> valuesToSet) {*
    *if (valuesToSet == null) {*
    return gridValues;
    gridValues = new ArrayList<gridProps>();
    if(btnValue.equals("completeBtn"))
    return gridValues;
    for(ArrayList<String> tempArr:valuesToSet)
    gridProps gp = new gridProps();
    gp.setSno(Integer.valueOf(tempArr.get(0)));
    gp.setOrderNum(tempArr.get(1));
    return gridValues;
    Right click gridPopulate class and create this as data control.This class will be seen in Data control list.Under this data control,Drag the grid property collection(created earlier) to your page.Then execute your binding(gridPopulate) according to your logic.
    Thanks.(My jdev version 11.1.1.5.0)

  • Parse errors while creating a Web service from Java class!

    Can anybody tell me please, is it possible to create a Web Service from java class where the input from user is required ?
    I have the following program, which is successfully compiled, but when I'm trying to make a web service in JDeveloper, the following error occurs:
    "Validation failed.
    The implementation class primePackage.isPrime ofport type MyWebService contains parse errors."
    import java.io.*;
    import java.util.*;
    class isPrime
    public static void main (String args[])
    Scanner reader = new Scanner(System.in);
    int n;
    System.out.println ("Enter a number you want to know is it prime or not");
    n=reader.nextInt();
    if (isPrime(n))
    System.out.println ("True");
    else
    System.out.println ("False");
    static boolean isPrime (int n)
    int i=2;
    while (i<=n-1)
    if (n%i==0)
    return false;
    i++;
    return true;
    }

    Hi,
    Can anybody tell me please, is it possible to create
    a Web Service from java class where the input from
    user is required ?Yes, the parameters of your method will be mapped in WSDL.
    But i've some considerations about your code.
    I suggest you change the name of isPrime do Prime, its a good code convention to put the name of class starting with Upper case. and isn't good the name of class equals to name of method.
    I suggest you to change the "static boolean isPrime (int n)" to "public boolean isPrime(int n)" to publish a method as a WebService method it's must be public and not static. After this change try to generate your Web Service.
    Regards.

  • WEB SERVICE FROM JAVA CLASS

    Hi,
    I'm new to BPEL and I've a problem: i need to create a WEBSERVICE from Java class.
    This Java class contain functions to call other functions in other packages.
    These last function contain sql query: it's an java "interface" application between BPEL and an EXTERNAL Oracle database 10g.
    I want to create one WEB SERVICE from this application and i followed the steps (right click, menù, create j2ee webservice, etc) i obtain error:
    VALIDATION FAILED --- Files at the following URLs cannot be modified:
    File:/C:/OraBPELPM1/integration/jdev/jdev/mywork/RichiesteWebService/ARRICH/app/src/controller/MyWebService1.webservice
    File:/C:/OraBPELPM1/integration/jdev/jdev/mywork/RichiesteWebService/ARRICH/app/src/controller/IMyWebService.wsdl
    File:/C:/OraBPELPM1/integration/jdev/jdev/mywork/RichiesteWebService/ARRICH/app/src/controller/MyWebService1.dd
    Show the java class "interface":
    package controller;
    import java.util.*;
    import java.sql.*;
    import domain.*;
    import dao.*;
    import utility.*;
    public class Request_Incoming_Controller {
    public Request_Incoming_Controller() {}
    /* Update StatoTurismo */
    public static String aggiornaStTurismo(int numIncoming, String tur) {
    GregorianCalendar dp = FormatoData.dataDaDate1("00/00/0000");
    Request_Incoming ric = new Request_Incoming(numIncoming,"","",dp,dp,"","","",0,"",tur,"");
    // try {
    if(ric.aggiornaTurismo()<0)return "NO";
    return "OK";
    // } catch (SQLException ex) {
    // System.err.println("Eccezione durante l'aggiornamento "
    // + ex.getMessage()); }
    /* Update StatoCassa */
    public static String aggiornaStCassa(int numIncoming,String cash) {
    GregorianCalendar dp = FormatoData.dataDaDate1("00/00/0000");
    Request_Incoming ric = new Request_Incoming(numIncoming,"","",dp,dp,"","","",0,"","",cash);
    // try {
    if(ric.aggiornaCassa()<0) return "NO";
    return "OK";
    // } catch (SQLException ex) {
    // System.err.println("Eccezione durante l'aggiornamento "
    // + ex.getMessage()); }
    /* Lettura del NumIncoming assegnato dal sistema dopo il caricamento della
    * richiesta in base alla matricola del Dipendente
    public static int caricaNumDaDip(String dipendente){
    Request_Incoming ric = new Request_Incoming(0,dipendente);
    // try {
    ric.trovaNumIncoming();
    return ric.getNumIncoming();
    // } catch (SQLException ex) {
    // System.err.println("Eccezione durante l'aggiornamento "
    // + ex.getMessage()); }
    Can Anyone help?
    Is urgently.........thanks
    Daniele

    You should try to post it there:
    http://forums.oracle.com/forums/forum.jspa?forumID=97
    But if I look at the error, it looks like some files are Read-Only. Maybe you should check if they are or if you have the appropriate rights on the folder.
    Good luck

  • Web Service From Java class, serialization problem

    Hi,
    I want to create Web Service from Java class, I made java project, generated web service from it, create web service archive project and deployed it to WAS 6.40.
    My class have 2 methods,
    public int add(int a, int b);
    public MyResponse doSomthing(MyRequest req);
    I can succesfully call add method from Web Service Navigator, it works fine but when I call doSomthing methods I get the following error:
    <b>
    Deserializing fails. Nested message: XML Deserialization Error. Result class [com.mycomp.sap_tech.ws.MyRequest] does not have property [Amount] of type [java.lang.String]. It is required to load XML..
    </b>
    Any ideas how to resolve it?
    P.S. MyRequest class is exposed throw VI, has default constractor and public getters and setters for all properties. It implements Serializable as well. Any guesses?
    Thanks in advance,
    Victor.

    Hi Bhavik, thanks for response.
    as I already mentioned it implements Serializable, so it is not the problem.
    Thanks Avi but it didn't helps iether
    Victor

  • Generating Excel report from java

    I'm generating Excel report from java .I want align a text in top ie)align top.i searched for that ,but i didn't get that.Is it possible to perform align top,if so how?

    the Progrma I' m executing is as follows :
    import java.io.*;
    import java.util.*;
    import jxl.*;
    import jxl.write.*;
    import jxl.write.Number;
    public class excel
    private String filename;
    private WritableWorkbook workbook;
    public excel(String fn)
    filename=fn;
    public void write() throws IOException, WriteException
    WorkbookSettings ws = new WorkbookSettings();
    ws.setLocale(new Locale("en", "EN"));
    workbook=Workbook.createWorkbook(new File(filename),ws);
    WritableSheet sheet=workbook.createSheet("First Sheet",0);
    Label label=new Label(0,2,"A label record");
    sheet.addCell(label);
    Number number=new Number(3,4,3.142);
    sheet.addCell(number);
    workbook.write();
    workbook.close();
    public static void main(String args[]){
         try{
                   excel ecl = new excel("D:\\TestXSL.xls");
                   ecl.write();
              }catch(Exception e){
              e.printStackTrace();
    }

  • Optimize MySQL table from Java

    Hi everyone,
    I was wondering if it's possible to run the optimize command on a mysql database table from within java?
    If so, does anyone have any code?
    Thanks,
    BBB

    assuming you have a table called myTable the code should look like...
    Connection c =// from somewhere
    Statement s = c.createStatement();
    s.execute("OPTIMIZE TABLE myTable");
    s.close();please note all the following...
    1) MySQL will lock the table when you optimize the table so if there are open locks this could deadlock while waiting. Also all other queries to be performed on the table will wait, just a performance warning.
    2) The logged-in user must have both SELECT and INSERT permission on the table to execute an OPTIMIZE.

  • How to generate database schema from CMP?

    I'm using JDeveloper 10g to design J2EE application in the Up-bottom manner. Then I have written UML model with CMP beans and now I would like deploy the model to the database. Is there a wizard to automaticly generate database schema from CMP beans?
    Marek

    Here are some links that might help you:
    The Oracle XML Developer's Kits (XDK) contain the basic building blocks for reading, manipulating, transforming and viewing XML documents. Includes XML Schema Processor: supporting Java, C, and C++, allows use of XML simple and complex datatypes.
    http://otn.oracle.com/tech/xml/xdkhome.html
    Building Server-Side XML Schema Validation
    Discusses how XML Schema can be used within Oracle9i to validate XML documents.
    http://otn.oracle.com/tech/xml/xdk_sample/xdksample_093001.html
    How XML Schemas Simplify Dynamic Content Management
    With XML Schema now a W3C Recommendation, compare Document Type Definitions to XML Schema.
    http://otn.oracle.com/tech/xml/htdocs/SchemDTD.html
    Regards,
    -rh

  • How to set classpath from java class ??

    I have tried to use System.setProperty("java.class.path", "my class path string ") to set classpath dynamically. But it is not working. How to set it dynamically from java class ?? Thanks , gary

    Look into the java.net.URLClassLoader. You can't set the classpath after the fact but you can specify URL's that will checked when you try to load a class with that loader.

  • How to View Tables from java side from NWDS/NWDI?

    HI All,
    I want to view the following tables from java side
    CRM_ISA_ADDRESS
    CRM_ISA_BASKETS
    CRM_ISA_BUSPARTNER
    CRM_ISA_EXTCONFIG
    CRM_ISA_EXTDATHEAD
    CRM_ISA_EXTDATITEM
    CRM_ISA_ITEMS
    CRM_ISA_OBJECTID
    CRM_ISA_SHIPTOS
    CRM_ISA_TEXTS
    How can I view them using NWDS/NWDI?
    Which DC has this tables?
    Could you please help me with the procedure to view them?
    Thanks and Regards,
    Gauri

    Hi All,
    crm/isa/isacoreddic and crm/isa/shopddic in SAP-CRMDIC are having these tables.
    Thanks and Regards,
    Gauri

  • Calling Servlet from Java Class in eclipse

    Hi ,
    I am calling a Servlet from JAVA Class as I am using IDE: Eclipse. The Problem is below
    URL url = new URL(ServletPath);
    URLConnection connet = url.openConnection();
    I am using the above code in JAVA to Connect to Servlet I have given Print statement in Servlet such that whenever it calls it prints on Console but when I try to run the code the Statement is not printed in the Console of eclipse I think URL connection is not able to establish any connection ..... if any has solution for this please reply
    Thanks & Regards,
    Arvind

    I am calling a Servlet from JAVA Class as I am using IDE: Eclipse. The Problem is below
    URL url = new URL(ServletPath);
    URLConnection connet = url.openConnection();Why should the Servlet running in different Runtime print on your Eclipse Runtime. Please be more clear about the question.

  • Modify database table from internal table

    Hi All,
    I need to update database table from internal table which is having around 30000 records.
    I am using MODIFY tabname FROM TABLE int_tabname...
    Using this statement, I can modify the databse records very well. But user has some additional requirement.
    He wants that the table should be modified from the internal table and after modification we should have the erroneous records to be displayed if any.
    e.g. if 1500 records out of 30000 are erroneous then only 28500 records should be updated and 1500 records should be displayed as erroneous records so that the user can correct them and use them again for executing the program.
    Is there any FM which imports the database table name and internal table, modifies the database and exports an internal tanle with erroneous records?
    Any help will be appriciated,
    Regards,
    Neha

    Hi
    modifying datbase table useing internal table
    <b>advises</b> before updating this datbase table plz lock that table to avoid incosistency
    write the logic for modifying
    Modify the database table as per new dunning procedure
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    and finally unlock the table
    <b>example</b>
    *To lock table for further operations
      constants: lc_tabname TYPE  rstable-tabname  VALUE 'FKKVKP'  . "FKKVKP
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = lc_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc EQ 0.
      To fetch all the contract accounts for customers of the segment
      Households/SME.
        PERFORM fetch_contract_accounts using lc_tabname .
      ENDIF.                    " IF sy-subrc EQ 0.
    *wrote the logic
    Modify the database table as per new dunning procedure from internal table
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    *unlock the tbale
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
         TABNAME   =  uc_tabname .
    <b>Reward if usefull</b>

Maybe you are looking for

  • Linking to Podcast No Longer Works

    Hi, I have a link to my podcast embedded on a webpage as: http://www.itunes.com/podcast?id=214320347 The link used to work, but now gives me a file download dialogue instead of taking me to the podcast in iTunes as it used to. Any help on how to get

  • Language of the Apps

    You have got to be kidding me. There is NO search options in the App Store. How lame is that? I would like to browse the Games section, filter it for free games and then filter for those I can run in Dutch. No such luck. This is bad, real bad. I can

  • 11g Installer for windows

    Any idea when 11g Installer binaries for windows will be available , i want to install and play with it on my labtop....

  • Validate and Edit SQL Query Errors

    I am trying to "Validate or Edit SQL Query" in APEX 3.0. When I open up the SQL Query its highlighted in red and when I click on the Validate or Edit button it gives me an error. I modified my marvel.conf file to include: AddType text/xml xbl AddType

  • Windows 7 Pro or Home, 64 or 32 bits for MacBook Pro 13"

    Windows 7 Pro or Home, 64 or 32 bits, for Boot Camp in a MacBook Pro 13"  2012?