Can't get JDeveloper/OC4J to auto-create MySQL table

My EJB 3.0 based application is failing to create the MySQL table specified by the @TableGenerator annotation.
Following are the details of my setup and application:
System Setup:
- JDeveloper 10.1.3.1.0
- JDK 1.5.0_07
- Ubuntu Linux kernel 2.6.15-27-k7
- MySQL 5.0
- MySQL ConnectorJ 3.1.13
- Using the embedded OC4J server.
I have done the following so far:
1. Created a database in MySQL called, "test". Did not create any tables.
2. Created a JDeveloper library whose classpath contains the MySQL ConnectorJ JAR file, and tested a database connection from JDeveloper successfully.
3. Added the MySQL/JDeveloper library to my ejb project, "Test1/Model", and selected the database connection from the project properties EJB panel. The database connector is called, "SmashDB". Selecting the database connector on the EJB panel resulted in JDeveloper setting "SmashDBDS" as the default datasource.
A JSF managed bean calls an EJB Session Bean, CustomerFacadeBean.persistEntity(Customer customer) with a Customer object as a parameter to save in the database. OC4J successfully connects to the MySQL "test" database, but fails when trying to access the ID_GENERATOR table, which is specified in an @TableGenerator annotation. The class-level annotations in the Customer entity are as follows:
@Entity
@NamedQuery(name = "Customer.findAll", query = "select o from Customer o")
@TableGenerator(name = "BasicIDGen", table = "ID_GENERATOR", pkColumnName = "GEN_KEY",
pkColumnValue = "CUSTOMER_ID", valueColumnName = "GEN_VALUE")
public class Customer implements Serializable {
private Long id;
private Integer version;
private String firstName;
private String lastName;
private String emailAddr;
My persistence.xml file contains:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="Model">
<properties>
<property name="toplink.ddl-generation" value="drop-and-create-tables"/>
</properties>
</persistence-unit>
</persistence>
With the above definition for Customer and persistence.xml, I expected the ID_GENERATOR and CUSTOMER tables to be created automatically, but this doesn't seem to be happening.
Instead, I get the following error message and stack trace:
2006-09-27 12:25:29.564 ERROR J2EE EJB-08006 [CustomerFacade:public java.lang.Object facade.CustomerFacadeBean.persistEntity(java.lang.Object)] exception occurred during method invocation: oracle.oc4j.rmi.OracleRemoteException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Table 'test.ID_GENERATOR' doesn't existError Code: 1146
Call:UPDATE ID_GENERATOR SET GEN_VALUE = GEN_VALUE + ? WHERE GEN_KEY = ?
     bind => [50, CUSTOMER_ID]
Query:DataModifyQuery(); nested exception is:
     Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Table 'test.ID_GENERATOR' doesn't existError Code: 1146
Call:UPDATE ID_GENERATOR SET GEN_VALUE = GEN_VALUE + ? WHERE GEN_KEY = ?
     bind => [50, CUSTOMER_ID]
etc.....
Help would be greatly appreciated. I've gotten to this point, which appears to be one error away from success (I hope) but don't have a clue what this problem is caused by.
Thanks,
Rick Horowitz

darby wrote:
I can't get this to compile. help!
You can not issue DDL in PL/SQL. You need to use dynamic SQL for that:
create or replace
PROCEDURE CREATE_STAGING_TABLES as
BEGIN
  -- I CAN'T GET THIS TO WORK BUT I CAN COPY THESE LINES AND RUN THEM AND THEY WORK! WHATUP?
  DBMS_OUTPUT.PUT_LINE('Begin Create Import Tables');
  EXECUTE IMMEDIATE 'Create table FAC_STAGING_PROJECTS As select * from FAC_PROJECTS where 1=2';
    EXECUTE IMMEDIATE 'alter table FAC_STAGING_PROJECTS add(ERROR_DESCRIPTION VARCHAR2(4000 CHAR))';
    EXECUTE IMMEDIATE 'alter table FAC_STAGING_PROJECTS add(bImported NUMBER)';
    EXECUTE IMMEDIATE 'alter table FAC_STAGING_PROJECTS add(dteImported DATE)';
  EXECUTE IMMEDIATE 'Create table FAC_STAGING_PURCHASE_ORDERS As select * from FAC_PURCHASE_ORDERS where 1=2';
    EXECUTE IMMEDIATE 'alter table FAC_STAGING_PURCHASE_ORDERS add(ERROR_DESCRIPTION VARCHAR2(4000 CHAR))';
    EXECUTE IMMEDIATE 'alter table FAC_STAGING_PURCHASE_ORDERS add(bImported NUMBER)';
    EXECUTE IMMEDIATE 'alter table FAC_STAGING_PURCHASE_ORDERS add(dteImported DATE)';
  DBMS_OUTPUT.PUT_LINE('End Create Import Tables'); 
  EXCEPTION
   WHEN OTHERS THEN
     raise_application_error(-20022,substr(SQLERRM,1,255));
END CREATE_STAGING_TABLES;SY.
P.S. I am not questioning why do you need to create tables from a stored procedure.

Similar Messages

  • How can I get a movie that I created in IDVD to load in ITunes and stream to Apple TV?

    How can I get a movie that I created in IDVD to load in ITunes and stream to Apple TV?

    Welcome to the Apple Community.
    You can't, but you have a few alternatives.
    Best option: If you made the movie on the DVD in iMovie (or even another editing application) and still have the project, go back to the project and export it for Apple TV (using the Apple TV preset)
    Next best option: If you still have the original movie that you put on the DVD, open it in QuickTime and export it for Apple TV (using the Apple TV preset)
    Worst option: Use something like Mpegstreamclip (Quicktime Mpeg2 playback component required) to convert the DVD to h264.

  • Living in Dubai where many apps are blocked. How can I get around ? Tried to create a new Id but my billing address in Dubai will not match the criteria for an account in the US. Help please to get around the censorship...thnaks

    Living in Dubai where many apps are blocked. How can I get around ? Tried to create a new Id but my billing address in Dubai will not match the criteria for an account in the US. Help please to get around the censorship...thanks

    The censorship in regards to certain apps not being available in your country is by your country, not by Apple.
    Due to various laws and licensing in each country, in order to have an iTunes store account in a particular country you must have a credit card with a billing address in that country. If this were up to Apple, there would be no such requirement and there would be only one iTunes store for the entire world, but various laws, regulations, and licensing issues in each country, this is required by Apple.

  • I can't get email even if I created the security password!,the way giving by Apple

    I can't get email even if I created the security password!,the way giving by Apple

    Never mind, I was very disappointed and I didn't  what I wrote,but I resolved my problem.

  • IPhone, can not get it out of Auto-lock

    On occasions once my 3g Iphone has gone into autolock I am unable to use the phone again. I can not get it out of auto lock, I have tried restarting but it maskes no difference.
    I often have to ring it from another phone to bring the Iphone back to life, which is rather annoying and I am not always by another avaliable phone.
    Does anyone else have this problem, or know how to fix this? Thanks

    Have you tried reset (page 34 of the manual)?
    Restore - page 141?
    http://manuals.info.apple.com/enUS/iPhone_UserGuide.pdf

  • How can I get list of columns used of specific table in all stored procedure?

    How can I get used column list of a specific table in among all stored procedure?
    Suppose that,
    I have a table(VendorMaster) which has 100 columns just I want to know how many columns used in among all stored procedure.

    We have solved by below query...
    IF OBJECT_ID('tempdb.dbo.#SPDependencyDetails') IS NOT NULL
    DROP TABLE #SPDependencyDetails
    CREATE TABLE #SPDependencyDetails
     Or_Object_Database NVARCHAR(128)
    ,Or_Object_Name NVARCHAR(128)
    ,Ref_Database_Name NVARCHAR(128)
    ,Ref_Schema_Name NVARCHAR(128)
    ,Ref_Object_Name NVARCHAR(128)
    ,Ref_Column_Name NVARCHAR(128)
    ,Is_Selected BIT
    ,Is_Updated BIT
    ,Is_Select_All BIT
    ,Is_All_Columns_Found BIT
    DECLARE @database_name VARCHAR(100)
    DECLARE database_cursor CURSOR
    FOR
    SELECT name
        FROM sys.databases
        WHERE database_id =8
    OPEN database_cursor
    FETCH NEXT FROM database_cursor
    INTO @database_name
    WHILE @@FETCH_STATUS = 0 --Outer Loop begin
    BEGIN
        DECLARE  @WholeLotofSQL NVARCHAR(MAX) =       '
        DECLARE @object_name VARCHAR(150)
        ,@sqlstatement NVARCHAR(2500)
        DECLARE object_cursor CURSOR --Inner cursor, iterates list of objects that match type
        FOR
            SELECT name
                FROM '+@database_name+'.sys.objects AS o
                WHERE o.type = ''P'' --Change Object type to find dependencies of Functions, Views and etc.
                ORDER BY 1    
        OPEN object_cursor
        FETCH NEXT FROM object_cursor INTO @object_name
        WHILE @@FETCH_STATUS = 0  --Inner Loop Begin
            BEGIN
                SET @sqlstatement = ''USE '+@database_name+';
                                    INSERT INTO #SPDependencyDetails
                                    SELECT DB_NAME() AS Or_Object_Database
                                            ,'''''' + @object_name + '''''' AS Or_Object_Name
                                            ,CASE WHEN referenced_database_name IS NULL THEN DB_NAME()
                                                    ELSE referenced_database_name
                                            END AS Ref_Database_Name
                                            ,referenced_schema_name AS Ref_Schema_Name
                                            ,referenced_entity_name AS Ref_Object_Name
                                            ,referenced_minor_name AS Ref_Column_Name
                                            ,is_selected
                                            ,is_updated
                                            ,is_select_all
                                            ,is_all_columns_found
                                        FROM sys.dm_sql_referenced_entities(''''dbo.'' + @object_name + '''''', ''''OBJECT'''');''
                EXEC sys.sp_executesql @sqlstatement
                FETCH NEXT FROM object_cursor INTO @object_name
            END      
        CLOSE object_cursor
        DEALLOCATE object_cursor'
        EXEC sys.sp_executesql @WholeLotofSQL
        FETCH NEXT FROM database_cursor INTO @database_name
    END
    CLOSE database_cursor;
    DEALLOCATE database_cursor;
    SELECT Or_Object_Database as 'Database'
    ,Or_Object_Name as 'Procedure'
    ,Ref_Object_Name as 'Table'
    ,Ref_Column_Name as 'Column'
    FROM #SPDependencyDetails

  • Hi all, where can i get a good refrence for Indexing for Tables..... HELP!

    hi all, where can i get a good refrence for Indexing for Tables..... HELP!
    i am looking for a information on indexing of tables.'
    Saurabh

    Thanks Mamta.........
    but meanwhile i got this link...check it out
    http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eb20446011d189700000e8322d00/content.htm
    [http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eb20446011d189700000e8322d00/content.htm]

  • Can anyone please guide me how to create a table like employe table with 10

    Hi,
    can anyone please guide me how to create a table like employe table with 10colums.
    after that we need to update the colums with personal details......like name1,name2,address,city,zip...etc.
    using the RFC we need to update the personal details coulums (either select query or Insert command)
    if you have any program logic similar to this requirement please share with me...that would br greatly helpfull to me...
    thanks in advance
    srinivas

    Hi....
    We are having one table and now i am going to update that table's fields...
    for that in RFC function module we need to enter the fields in importing parameters (which are mandtory in table)
    and in source code just write like following....
    ( try to under stand that it contains some previous used table nad field and stucture and work area and function module names)
    FUNCTION ZL2C_UPDATE_MYCUSTOMER.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(USR_ID) TYPE  USRID
    *"     VALUE(LOGO_ID) TYPE  KUNNR
      DATA ls_mycust TYPE zl2cmy_customer.
      DATA: name1 TYPE name1_gp.
      DATA: sharpoint_url TYPE url.
      ls_mycust-usr_id        = usr_id.
      ls_mycust-logo_id       = logo_id.
      SELECT SINGLE name1 FROM kna1 INTO name1 WHERE kunnr = logo_id.
        ls_mycust-name1       = name1.
        SELECT SINGLE sharpoint_url FROM zl2c_CUSDASHBRD INTO sharpoint_url WHERE logo_id = logo_id.
          ls_mycust-sharpoint_url = sharpoint_url.
          INSERT into zl2cmy_customer values ls_mycust.
          COMMIT WORK.
        ENDFUNCTION.

  • Failed to create MySQL tables. Installation aborted. BOE XI 3.1 Linux

    Tried to do a full install of BOE XI 3.1 Linux on Redhat 5 with at least the mimimum requirements and it goes through fine but then in the end errors out with "Failed to create MySQL tables. Installation aborted." Any ideas on what is causing this and how to fix it?

    Hello Fred,
    I recommend to post this query to the [BusinessObjects Enterprise Administration|BI Platform; forum.
    This forum is dedicated to topics related to administration and configuration of BusinessObjects Enterprise, BusinessObjects Edge, and Crystal Reports Server.
    It is monitored by qualified technicians and you will get a faster response there.
    Also, all BOE Administration queries remain in one place and thus can be easily searched in one place.
    Best regards,
    Falk

  • How can I get JDeveloper Extension sdk for 9.0.4 version

    HI~
    I want to download JDeveloper Extension sdk for 9.0.4 version.
    Of course, I found some link for downloading, but all of them I found were not connected or connected with 11g version.
    I also try to install the sdk in JDeveloper menu called "Check for updates" in help menu. But it was not operated in my pc(Windows 7 64bit).
    I really need to older version Extension sdk.
    How can I get the sdk?

    The only way I see is through support. Versions this old are not accessible via the web.
    Timo

  • Can't get jdeveloper find getBindings neither getOperationBinding

    Hi, I tried importing all libraries, and I can't get getBindings, be recognized in this code neither in other similar code.
    I checked several examples, in different proyects, I even download myadflearningapp proyect but anyway it don't compile, I can't understand what I'm doing wrong.
    jdev 11.1.1.0.2
    if you can helpme please.
    bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("Commit");
    Thank you :)
    The full code:
    package view.beans;
    import oracle.adf.model.BindingContainer;
    import oracle.binding.OperationBinding;
    import javax.faces.application.FacesMessage;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.binding.OperationBinding;
    public class RegistrationBean
    private boolean disableAddItemBtn;
    private boolean disableSearchCataBtn;
    private String regId;
    public RegistrationBean()
    public void setDisableAddItemBtn(boolean disableAddItemBtn) {
    this.disableAddItemBtn = disableAddItemBtn;
    public boolean isDisableAddItemBtn() {
    return disableAddItemBtn;
    public void setDisableSearchCataBtn(boolean disableSearchCataBtn) {
    this.disableSearchCataBtn = disableSearchCataBtn;
    public boolean isDisableSearchCataBtn() {
    return disableSearchCataBtn;
    public void setRegId(String regId) {
    System.out.println("inside bean regid="+regId);
    this.regId = regId;
    public String getRegId() {
    return regId;
    public String commandButton_action() {
    // Add event code here...
    BindingContainer bindings;
    bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("Commit");
    return null;
    }

        public BindingContainer getBindings() {
            if (this.bindings == null) {
                FacesContext fc = FacesContext.getCurrentInstance();
                this.bindings =
                        (BindingContainer)fc.getApplication().evaluateExpressionGet(fc, "#{bindings}",
                            BindingContainer.class);
            return this.bindings;
        }

  • How can I get data in flat file from Pool table and cluster table ?

    Hi,
    I am working in one Achiving project. My requirement is to get data into flat file from Cluster table and pool table.
    Is there any tool avilable to download data into flat file from pool table and cluster table ?
    if table name given in the selection screen then data will be downloaded into flat file.
    waiting for quick response.
    Best Regards,
    Bansidhar

    Data cannot be retrived directly form the cluster table
    as the Cluster results are stored in Cluster Key say for example PCLkey
    and form that Key we need to fetch the data
    these clustes are not the part of PNP or PNPCE tables
    for ur info kindly check

  • Trouble creating mySQL tables

    I am running CF9 64bit on windows 7. I created the database on mySQL 5.6 server. I created the datasource, theough the CF Admin, for kalendar and it verified. I then tried using the following code to create 2 table, but I recevied an error that just says "Error!" when I tried running the script. I posted the script on  mySQL forums and was told the code ran fine. What am I not seeing?
    <cfquery name="qCreateTable"  datasource="kalendar">
    CREATE TABLE  tblkalendar (
      EventID varchar(100) NOT NULL,
      CategoryID int(10) NOT NULL,
      IsDeleted tinyint(1) NOT NULL default '0',
      IsPublished tinyint(1) NOT NULL default '0',
      IsFeatured tinyint(1) NOT NULL default '0',
      DateTimeCreated timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
      StartDate datetime NOT NULL,
      EndDate datetime NOT NULL,
      StartTime varchar(50) default NULL,
      EndTime varchar(50) default NULL,
      ContactPhone varchar(50) default NULL,
      ContactName varchar(100) default NULL,
      ContactEmail varchar(50) default NULL,
      Title varchar(150) NOT NULL,
      Location varchar(150) default NULL,
      Teaser varchar(350) default NULL,
      ExternalURL varchar(500) character set utf8 default NULL,
      Description longtext NOT NULL,
      PRIMARY KEY  (EventID),
      KEY IX_tblKalendar (StartDate,EndDate),
      KEY FK_tblKalendar_tblKalendarCategories (CategoryID)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    CREATE TABLE  tblkalendarcategories (
      CategoryID int(10) NOT NULL auto_increment,
      CategoryName varchar(50) NOT NULL,
      CategoryBGColor varchar(7) NULL,
      CategoryTextColor varchar(7) NULL,
      PRIMARY KEY  (CategoryID)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    </cfquery>

    you should rethink whether you need to create a database using java. personally i think it's a bad idea. your database should exist and the schema should be ready to go when your app starts. why do you think you need to create one?
    %

  • Can't get rid of beachball after creating text layers

    Created 7 simple text layers. All was fine till I added simple cross dissolve transition to all layers at once. Now constant beachball. And can't even open any projects after force quitting. In fact as soon as I got to project library and move my mouse I get the beachball.
    Any ideas?

    Try deleting the project render files. Quit FCP X, then lin the Finder locate the folder for your project inside the "Final Cut Projects" folder, then trash the "Render Files" folder inside it. See if that helps.

  • Where can i get sample custom project for creating custom project

    I installed Plumtree_Portal_UI_Customization. now i want to develop my own custom project. when i installed this ptshared folder is not created so i am not having this,
    SOURCE_HOME\ptshared\6.0\ptwebui-samples\samplecustomproject .
    Even i am not able to download SampleProjects-60x.zip file.can anybody helps me regarding this.Give me the exact URL for this ZIP.I am not able to find the samples directory.
    Advance thanks.
    bye
    Amit

    I tried pasting the direct URL in here, but that doesn't seem to work. So the steps to follow are:
    1. Go to http://dev2dev.bea.com
    2. Select the CodeShare link under Get Involved in the left hand menu.
    3. Select 'Code Samples' under 'Popular Projects'
    4. Under 'By Product', select AquaLogic User Interface.
    5. Select Artifact ID S265
    6. Select the Attachements/Dependencies/URLs tab

Maybe you are looking for