Adf ejb jpa persistance problem

Hi everyone,
I`m a newbie to adf technology.
I was trying Build a Web Application with JDeveloper 11g Using EJB, JPA, and JavaServer Faces tutorial
([http://www.oracle.com/technology/obe/obe11jdev/11/ejb/ejb.html])
I have a problem when I try to run it.
It says;
javax.ejb.EJBException: EJB Exception: ; nested exception is:
Exception [EclipseLink-4002|http://forums.oracle.com/forums/] (Eclipse Persistence Services - 1.0.1 (Build 20080905)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904: "EMAİL": geçersiz belirleyici (invalid identifier)
I thing it`s becouse I use a turkish operating system.
I tried to change the encoding settings to windows1252 intead of windows 1254 but same problem occures.
It makes the column EMAIL to EMAİL
Could you please help me abpout this problem?

Hi,
can you print out the value that is received in the session facde to see where the conversion happens?
Frank

Similar Messages

  • Problems with ADF when running sample EJB, JPA, JSF Tutorial

    Hi,
    I'm new to jDeveloper.
    I've downloaded the version 11.1.1.2.0 and tried to do my first tutorials with the product.
    I started with the sample 'Build Applications with EJB, JPA and JSF' and run to following problems:
    - Part1: Step 10 expose the EJb as a Data Control
    Here right-click FODFacadeBean.java and choose Create Data Control.
    this option 'Create Data Control' does not come up at all. There is not such option
    - Part 2: Step 1 Add Tag Libraries to a project
    The option to select ' ADF Faces Components 11 '
    does not come up either. I can not see any ADF related options...
    Is there something missing from my installation, as I can not access these ADF components ?
    Should I include the ADF components at some stage during the installation to be able to access these
    or is this some licencing option ?
    I downloaded the product yesterday from the public download site, filename jdevstudio11112install.exe
    Jan-Erik

    Hi,
    I'm new to jDeveloper.Welcome to OTN :)
    I've downloaded the version 11.1.1.2.0 and tried to do my first tutorials with the product.
    I started with the sample 'Build Applications with EJB, JPA and JSF' and run to following problems:
    - Part1: Step 10 expose the EJb as a Data Control
    Here right-click FODFacadeBean.java and choose Create Data Control.
    this option 'Create Data Control' does not come up at all. There is not such optionI just tried and able to see the option (and able to generate the DC from the facade as well). Could you please share the tutorial link to see if you are missing something?
    >
    - Part 2: Step 1 Add Tag Libraries to a project
    The option to select ' ADF Faces Components 11 '
    does not come up either. I can not see any ADF related options...Did you select Fusion Web Application (ADF) Template for creating your application? If yes, the ADF Faces Components 11 tag library would've been added by default (Check out in the list of tag libraries that are already added - before clicking on the Add button).
    -Arun

  • Start a JPA persistent cache server but it is hanging

    I create a JPA persistence project and online EJB object HR.EMPLOYEES according to the guide of Chapter 6 of
    Tutorial for Oracle Coherence (3.5). But when I tried to start a JPA persistent cache server, it is hanging and report
    the following message:
    I don't know what is the problem.
    C:\coherence\bin>jpa-cache-server.cmd
    java version "1.6.0_16"
    Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
    Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode)
    2009-11-04 15:11:37.767/0.532 Oracle Coherence 3.5.2/463 <Info> (thread=main, member=n/a):
    Loaded operational configuration from resource "jar:file:/C:/coherence/lib/coherence.jar!/tangosol-
    coherence.xml"
    2009-11-04 15:11:37.767/0.532 Oracle Coherence 3.5.2/463 <Info> (thread=main, member=n/a):
    Loaded operational overrides from resource "jar:file:/C:/coherence/lib/coherence.jar!/tangosol-
    coherence-override-dev.xml"
    2009-11-04 15:11:37.782/0.547 Oracle Coherence 3.5.2/463 <D5> (thread=main, member=n/a):
    Optional configuration override "/tangosol-coherence-override.xml" is not specified
    2009-11-04 15:11:37.782/0.547 Oracle Coherence 3.5.2/463 <D5> (thread=main, member=n/a):
    Optional configuration override "/custom-mbeans.xml" is not specified
    Oracle Coherence Version 3.5.2/463
    Grid Edition: Development mode
    Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
    2009-11-04 15:11:38.157/0.922 Oracle Coherence GE 3.5.2/463 <Info> (thread=main, member=n/a):
    Loaded cache configuration from "file:/C:/home/oracle/coherence/JPA/jpa-cache-config.xml"
    2009-11-04 15:11:38.188/0.953 Oracle Coherence GE 3.5.2/463 <Info> (thread=main, member=n/a):
    Started DefaultCacheServer
    SafeCluster: nullThe contents of jpa-cache-server.cmd file is shown here under:
    setlocal
    :config
    @rem specify the Coherence installation directory
    set coherence_home=C:\coherence
    @rem specify the JVM heap size
    set memory=512m
    :start
    if not exist "%coherence_home%\lib\coherence.jar" goto instructions
    if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
    :launch
    set java_opts="-Xms%memory% -Xmx%memory% -Dtangosol.coherence.cacheconfig=
    C:\home\oracle\coherence\JPA\jpa-cache-config.xml"
    "%java_exec%" -server -showversion "%java_opts%" -cp "%coherence_home%\lib\coherence.jar;
    C:\home\oracle\coherence\JPA\classes;C:\coherence\lib\coherence-jpa.jar;C:\Oracle\Middleware\
    wlserver_10.3\server\lib\ojdbc6.jar;C:\Oracle\Middleware\modules\javax.persistence_1.0.0.0_1-0-2.jar;
    D:\toplink_11\jlib\eclipselink.jar" com.tangosol.net.DefaultCacheServer %1
    goto exit
    :instructions
    echo Usage:
    echo   ^<coherence_home^>\bin\cache-server.cmd
    goto exit
    :exit
    endlocal
    @echo onEdited by: junez on 04-Nov-2009 12:31

    Now report the following message:
    C:\coherence\bin>jpa-cache-server.cmd
    java version "1.6.0_16"
    Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
    Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode)
    2009-11-04 16:03:54.320/0.563 Oracle Coherence 3.5.2/463 <Info> (thread=main, member=n/a): Loaded operational configurat
    ion from resource "jar:file:/C:/coherence/lib/coherence.jar!/tangosol-coherence.xml"
    2009-11-04 16:03:54.320/0.563 Oracle Coherence 3.5.2/463 <Info> (thread=main, member=n/a): Loaded operational overrides
    from resource "jar:file:/C:/coherence/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
    2009-11-04 16:03:54.335/0.578 Oracle Coherence 3.5.2/463 <D5> (thread=main, member=n/a): Optional configuration override
    "/tangosol-coherence-override.xml" is not specified
    2009-11-04 16:03:54.335/0.578 Oracle Coherence 3.5.2/463 <D5> (thread=main, member=n/a): Optional configuration override
    "/custom-mbeans.xml" is not specified
    Oracle Coherence Version 3.5.2/463
    Grid Edition: Development mode
    Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
    Exception in thread "main" (Wrapped: Failed to load the factory) java.lang.reflect.InvocationTargetException
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
            at com.tangosol.net.DefaultCacheFactoryBuilder.getDefaultFactory(DefaultCacheFactoryBuilder.java:419)
            at com.tangosol.net.DefaultCacheFactoryBuilder.getSingletonFactory(DefaultCacheFactoryBuilder.java:113)
            at com.tangosol.net.DefaultCacheFactoryBuilder.getFactory(DefaultCacheFactoryBuilder.java:173)
            at com.tangosol.net.DefaultCacheFactoryBuilder.getConfigurableCacheFactory(DefaultCacheFactoryBuilder.java:149)
            at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:657)
            at com.tangosol.net.DefaultCacheServer.main(DefaultCacheServer.java:49)
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
            at com.tangosol.net.DefaultCacheFactoryBuilder.getDefaultFactory(DefaultCacheFactoryBuilder.java:381)
            ... 5 more
    Caused by: (Wrapped: Failed to load configuration: C:\home\oracle\coherence\JPA\jpa-cache-config.xml) (Wrapped) java.io.
    IOException: Exception occurred during parsing: looking for id=9, found id=3((0,0,0) Character Data Literal xml version=
    "1.0" encoding="windows-1252" ?>
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultConfigurableCacheFactory.java:403)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultConfigurableCacheFactory.java:372)
            at com.tangosol.net.DefaultConfigurableCacheFactory.<init>(DefaultConfigurableCacheFactory.java:141)
            ... 11 more
    Caused by: (Wrapped) java.io.IOException: Exception occurred during parsing: looking for id=9, found id=3((0,0,0) Charac
    ter Data Literal xml version="1.0" encoding="windows-1252" ?>
            at com.tangosol.run.xml.XmlHelper.loadXml(XmlHelper.java:137)
            at com.tangosol.run.xml.XmlHelper.loadXml(XmlHelper.java:152)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultConfigurableCacheFactory.java:395)
            ... 13 more
    Caused by: java.io.IOException: Exception occurred during parsing: looking for id=9, found id=3((0,0,0) Character Data L
    iteral xml version="1.0" encoding="windows-1252" ?>
            at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:134)
            at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:71)
            at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:99)
            at com.tangosol.run.xml.XmlHelper.loadXml(XmlHelper.java:133)
            ... 15 more

  • ADF and JPA  question

    I tried the example in 'Build a Web Application with JDev 10g Using EJB, JPA and JSF and it worked.
    This example is based on two tables. Now I have 6 tables. Tables 1,2 and 3 are joined to populate an ADF table form and tables 1,2,4,5 and 6 are joined to populate another ADF form.
    My question is: should I use JDev to generate all 6 entity EJBs or rather create two Oracle views for each of these joins and get JDev to generate EJB for each of these views?
    Also, how can I customize the annotated queries generated by JDev? I would like to have all the native SQLs to be in separate XML files. Should I use XML files generated by JDev or create a new XML file? Is there an example of how to do that?

    Hello,
    I read somewhere JPA supports external XML native SQL queries and apparently these queries override named queries in entity annotations. Assuming this is true, would that be the preffered way (both queries, 1-2-3 join and 1-2-4-5 join have one input parameter each so the database views would have to be parametrized in that case)? And how should I access these XML based queries from inside the code?
    Also, what queries are generated by JDev JPA when 6 tables are selected? Are all combinations based on foreign keys generated or just table (entity) and its directly related tables?
    Thanks,
    Sale

  • CAn EJB do persistance without hibernate?

    Hai All.....
    My doubt is that 'Can EJB do persistance without hibernate or any other tools'?
    Can EJB do persistance alone??
    Please Help

    EJB 3, and JPA are just specification, not implementation. EJB 3 alone cannot do anything, it is just interfaces. Any product that implements the EJB 3 spec will support EJB SessionBeans and JPA and persistence.
    Any JEE 5 server will support EJB 3 and JPA persistence (WebLogic, OC4J, Glassfish, JBoss, WebSphere, etc...). Each server uses a different product to support JPA, (Glassfish v2 uses TopLink Essentials, OC4J 11g uses TopLink, WebLogic uses Kodo, JBoss uses Hibernate, Glassfish v3 uses EclipseLink, etc.). Technically if you are using JEE 5, you don't need to worry about what JPA product you are using and can consider that EJB supports persistence, but more than likely you will need to know you JPA provider in more intimacy.
    You will also need a database to persist to. Again most JEE server bundle a database, but most production applications prefer to choose their own database.
    The JPA part of EJB also works outside of JEE, in this case you will need to choose one of the many JPA products.
    see,
    [http://en.wikibooks.org/wiki/Java_Persistence/What_is_JPA%3F|http://en.wikibooks.org/wiki/Java_Persistence/What_is_JPA%3F]
    -- James : [http://www.eclipselink.org|http://www.eclipselink.org]

  • Persistant problems with FF 27.0.1 on Windows 7/64

    I seem to have a persistent problem with Firefox 27.0.1 and my MSN homepage. When I open FF, it takes me to both my Outlook Mail page and My MSN pages in two separate tabs. Outlook Mail had a problem taking my correct password, but that issue seems to have resolved itself (I did clear all cookies and caches related to the website). But My MSN is still giving me this message...
    "The page you have requested cannot be found.
    The web page you were attempting to view may not exist or may have moved — try checking the web address for typos."
    I tried the same thing as I did with Outlook (deleted cookies and caches), but the problem persists. I disabled all plugins, and still no luck. The MSN Homepage comes up, and I'm shown as logged into My MSN, but when I click the My MSN link, I get the "The page you have requested..." message.
    Another issue relating to both websites is password remembering. FF will NOT ask to remember the passwords for those sites. I have Remember Passwords box checked in Settings and it does for other sites, but not my Homepage(s). Clearing cookies/caches didn't help, and the password is not listed in the Remembered Passwords page of Settings.
    Finally, Firefox on my home laptop (Windows 7/64 as well) freezes and crashes a lot, as well as displayes a warning there is something with Flash, which I have updated many times over.
    I used to use Internet Explorer as a browser exclusively until I started having problems with certain websites not allowing me to log in. I realized it was not the website, but some incompatibility with IE. I started using Firefox, and fouind no problems, and heard it was more secure and easier to configure than Internet Explorer anyway. But since these problems started occurring (especially with NO way for me to log onto My MSN), I have to go back to using IE (except for select website logons), which is disappointing :-(.

    About your home page; Manually set up Firefox with the window(s) and tab(s)
    the way you want them to be. Then;
    '''''Firefox Options > General > Homepage'''''.
    Press the button labeled ''''Use Current'''.'
    =====================================
    Open a new window or tab. In the address bar, type '''''about:config'''''.
    If a warning screen comes up, press the '''''Be Careful''''' button.
    This is where Firefox finds information it needs to run.
    At the top of the screen is a search bar. Enter '''''browser.newtab.url'''''
    and press enter. '''''browser.newtab.url'''''
    tells Firefox what to show when a new tab is opened.
    If you want, right click and select '''''Modify'''''. You can change the
    setting to;<BR><BR>about:home (Firefox default home page),<BR>
    about:newtab (shows the sites most visited),<BR>
    about:blank (a blank page),<BR>
    or you can enter any web page you want.<BR><BR>
    The same instructions are used for the new window setting, listed as
    '''''browser.startup.homepage'''''.

  • Stored procedure, EJB, JPA, and JavaServer Faces

    Hi!
    I am currently working on a Web application using EJB, JPA, and JavaServer Faces. A part of the
    business logic is already stored in the database as stored procedures, so we need to call those
    procedures (instead of named queries) through a EJB and represent the data on the web tier.
    Where can I find an extensive tutorial using this technology? There is no such tutorial in the Oracle Learning Library.
    Maybe somebody can provide a link and/or example.
    Thanks in advance for your help!

    Hi,
    http://download.oracle.com/docs/cd/B10464_05/web.904/b10313/queries.htm#1135305
    For more help, see the TopLink / JPA forum
    TopLink/JPA
    Frank

  • JPA persist() or merge()

    Hi All,
    I would like to get clarification between using JPA persist() and merge() where there is a OneToMany EMPLOYEE table unidirectionally joint to ManyToOne TELEPHONE table.
    The code snippet for OneToMany Employee.java entity object is as follows:
    @Entity
    @IdClass(EmployeePK.class)
    @Table(name="EMPLOYEE", catalog="CorporationDB", schema="")
    public class Employee implements Serializable {  
    @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
        @JoinTable(name="EMPLOYEE_TELEPHONE", catalog="CorporationDB", schema="",
                   joinColumns={@JoinColumn(name="FIRSTNAME", referencedColumnName="FIRSTNAME"),
                                @JoinColumn(name="SURNAME", referencedColumnName="SURNAME"),
                                @JoinColumn(name="AGE", referencedColumnName="AGE"),
                                @JoinColumn(name="SEX", referencedColumnName="SEX")},
                   inverseJoinColumns={@JoinColumn(name="TELEPHONE_ID")})
            private Collection<Telephone> telephones = new ArrayList<Telephone>();
        public Collection<Telephone> getTelephones()
         return telephones;
        public void setTelephones(Collection<Telephone> telephones)
         this.telephones = telephones;
        }The corresponding detail for ManyToOne Telephone.java entity object is:
    @Entity
    @Table(name="TELEPHONE", catalog="CorporationDB", schema="")
    public class Telephone implements Serializable {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name="ID")
        private int id;
        @Column(name="TELEPHONE")
        private String telephone;
        public void setTelephone(String telephone) {
            this.telephone = telephone;
        public String getTelephone() {
            return telephone;
        }I would like JPA to to ignore (not overwrite) existing record and only add newer unique telephone numbers. persist() does that except it is throwing the following exceptions and continually re-trying to insert the duplicate records:
    Local Exception Stack:
    *Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.DatabaseException*
    Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry Allan-Smith-20-M' for key 'PRIMARY'
    Error Code: 1062
    Call: INSERT INTO CorporationDB.EMPLOYEE (FIRSTNAME, SURNAME, AGE, SEX.....) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    *bind => [Allan, Smith, 20, M,....]*
    Query: InsertObjectQuery(finance.Employee@1d2d80c)
    JTS5054: Unexpected error occurred in after completion
    On the other hand, merge() ignores (does not add) duplicate Employee record (good) but it still duplicates the ManyToOne TELEPHONE table. Is it because of the OneToMany(cascade={CascadeType.ALL}} property in Employee.java which duplicates TELEPHONE records automatically? As a result, how to ensure that only unique OneToMany (EMPLOYEE) & ManyToOne (TELEPHONE) records are added once?
    persist() seems to work fine except that it is continually erroring out instead of skipping to the next new record.
    This Java EE 5 application is running properly.
    I am running JDK1.6.0_7, GF2.1 and MySQL on Windows XP.
    Thanks in advance,
    Jack

    I would recommend you continue to use TopLink Essentials as your JPA provider by setting your provider in your persistence.xml, or upgrading to EclipseLink and setting it as your provider. The latest WLS release also includes EclipseLink.
    James : http://www.eclipselink.org

  • Adf faces command button, bindings and ejb 3.0 persisting problem

    When mapping the persist method to an adf command button it got this error:
    1. JBO-29000: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21.; nested exception is: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21. -
    2. java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21.; nested exception is: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21. -
    Is that because Departments are serialized by the container when the session bean is accessed by the data control to catch the data when the form is populating and entities are detached from the persisting context ? or something else ?
    I bind the button to the current row data provider for the departments. Is it correct, isn't ?

    When mapping the persist method to an adf command button it got this error:
    1. JBO-29000: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21.; nested exception is: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21. -
    2. java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21.; nested exception is: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21. -
    Is that because Departments are serialized by the container when the session bean is accessed by the data control to catch the data when the form is populating and entities are detached from the persisting context ? or something else ?
    I bind the button to the current row data provider for the departments. Is it correct, isn't ?

  • JDeveloper 11g Using EJB, JPA AND ADF DOES NOT WORK IN VERSION 11.1.1.1.0

    Hi all,
    I'm facing serious problems after the migration from jdev 11.1.1.0 version to new release 11.1.1.1.0, as i published with a sample at
    Problems with create new record o in JDev 11 R1
    is this a big bug in the ide? Should i return to previous version?
    Thanks in advance
    Enrique

    Hi,
    my best recommendation is to work with customer supports in this testcase.
    Frank

  • EJB + JPA Troubles

    hello
    can anyone help me with this problem
    atm i'm making a project which uses EJBs (with JPA) and some fields in the EJBs get auto generated when persisting an EJB entity to the database
    Writing to the database and reading out of it works perfectly, but when i persist a brand new entity to the table, i don't receive the brand new generated ID
    (ID is a primary key in the table)
    is there any way to update the persisted entity right after persisting it to the database ? so that my entity, which got persisted, gets his ID injected?
    this is my code for inserting a new entity into the database:
    @Transactional
    public class JPAScenarioDAO implements ScenarioDAO{
        private EntityManager entityManager;
         * Spring injects entityManager
         * @param entityManager manager that handles persistence operations
        @PersistenceContext
        public void setEntityManager(EntityManager entityManager)
          this.entityManager = entityManager;
        public JPAScenarioDAO() {}
        public void createScenario(Scenario scenario){
            entityManager.persist(scenario); // <-- help?
        public void updateScenario(Scenario scenario){
            entityManager.merge(scenario);
        public void removeScenario(Scenario scenario){
            entityManager.remove(scenario);
    }The scenario is an EJB that i generated from a table
    import java.io.Serializable;
    import java.sql.Timestamp;
    import java.util.List;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToOne;
    import javax.persistence.NamedQueries;
    import javax.persistence.NamedQuery;
    import javax.persistence.OneToMany;
    import javax.persistence.Table;
    @Entity
    @NamedQueries({
        @NamedQuery(name = "Scenario.getScenarios",
                    query = "select o from Scenario o"),
        @NamedQuery(name = "Scenario.getScenariosBetweenDates",
                    query = "select o from Scenario o where o.date >= :datum1 and o.date <= :datum2"),
        @NamedQuery(name = "Scenario.getScenariosByEdition",
                    query = "select o from Scenario o where o.edition = :edition"),
        @NamedQuery(name = "Scenario.getScenariosByIssue",
                    query = "select o from Scenario o where o.issue = :issue"),
        @NamedQuery(name = "Scenario.getLast2ScenariosFromEdition",
                    query = "select o from Scenario o where o.edition = :edition order by o.date desc")
    @Table(name = "WEBE_MAKR_DRAAIBOEK")
    public class Scenario implements Serializable {
        @Id
        @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="s_webe_makr_draaiboek")
        @Column(name="DRAAIBOEK_ID", nullable = false)
        private Long scenarioID;
        @Column(name="JAAR")
        private Long year;
        @Column(name="WEEK")
        private Long week;
        @Column(name="DATUM")
        private Timestamp date;
        @ManyToOne
        @JoinColumn(name = "EDITIE_ID", referencedColumnName = "EDITIE_ID")
        private Edition edition;
        @OneToMany(mappedBy = "scenario")
        private List<ScenarioItemStatus> scenarioItemStatusList;
        @ManyToOne
        @JoinColumn(name = "VERSCHIJNING_ID", referencedColumnName = "VERSCHIJNING_ID")
        private Issue issue;
        @OneToMany(mappedBy = "scenario")
        private List<ScenarioHistory> scenarioHistoryList;
        // CONSTRUCTOR
        public Scenario() {}
        // GETTERS
        public Long getScenarioID() {
            return scenarioID;
        public Long getYear() {
            return year;
        public Long getWeek() {
            return week;
        public Timestamp getDate() {
            return date;
        public Edition getEdition() {
            return edition;
        public Issue getIssue() {
            return issue;
        public List<ScenarioItemStatus> getScenarioItemStatusList() {
            return scenarioItemStatusList;
        public List<ScenarioHistory> getScenarioHistoryList() {
            return scenarioHistoryList;
        // SETTERS
        public void setScenarioID(Long scenarioID) {
            this.scenarioID = scenarioID;
        public void setDate(Timestamp date) {
            this.date = date;
        public void setYear(Long year) {
            this.year = year;
        public void setWeek(Long week) {
            this.week = week;
        public void setEdition(Edition edition) {
            this.edition = edition;
        public void setIssue(Issue issue) {
            this.issue = issue;
        public void setScenarioItemStatusList(List<ScenarioItemStatus> scenarioItemStatusList) {
            this.scenarioItemStatusList = scenarioItemStatusList;
        public void setScenarioHistoryList(List<ScenarioHistory> scenarioHistoryList) {
            this.scenarioHistoryList = scenarioHistoryList;
        // EXTRA METHODS
        public ScenarioItemStatus addScenarioItemStatus(ScenarioItemStatus scenarioItemStatus) {
            getScenarioItemStatusList().add(scenarioItemStatus);
            scenarioItemStatus.setScenario(this);
            return scenarioItemStatus;
        public ScenarioItemStatus removeScenarioItemStatus(ScenarioItemStatus scenarioItemStatus) {
            getScenarioItemStatusList().remove(scenarioItemStatus);
            scenarioItemStatus.setScenario(null);
            return scenarioItemStatus;
        public ScenarioHistory addScenarioHistory(ScenarioHistory scenarioHistory) {
            getScenarioHistoryList().add(scenarioHistory);
            scenarioHistory.setScenario(this);
            return scenarioHistory;
        public ScenarioHistory removeScenarioHistory(ScenarioHistory scenarioHistory) {
            getScenarioHistoryList().remove(scenarioHistory);
            scenarioHistory.setScenario(null);
            return scenarioHistory;
    }Edited by: NeoSniperkiller on 17-apr-2008 14:46

    What database and JPA provider are you using? Since you are using a SEQUENCE object to generate the id, you should see it assigned after calling the persist(). Potentially you are using IDENTITY sequencing (not on Oracle), so you must first call flush() to have the id assigned.
    see,
    [http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing#Object.27s_id_is_not_assign_after_persist|http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing#Object.27s_id_is_not_assign_after_persist]
    -- James : EclipseLink

  • Question for Steve Muench - ADF/EJB & Applets?

    Steve or anyone who can help - Do you have any sample demo that can demonstrate how to take advantage of ADF caching technology on the server, or an EJB solution integrated with an applet in a web application?
    It is kind of late in the game, because we are about to roll out an application in our company, nevertheless we are still researching a better way for handling tremendous amount of data by our applet. We are using F1 Formula engine (spreadsheet like tech) in our applet. But, we have severe performance problems, especially in our remote locations trying to load thousands of rows in the applet and on top of that do all kinds of formatting and Excel like functionality in the applet grid at run time.
    We are looking for a way to integrate ADF or EJB caching solution with our applet, so that we can cache the client data on the app server if possible, in order to improve performance.
    Any guidance, suggestion and help is very much appreciated.
    Thanks,
    [email protected]

    Hi,
    my recommendation would be to use JavaWeb Start with BC deployed as EJB to the Application Server. This way you have a real client installation and don't need to download the Applet classes all the time (and JClient, assuming you use JClient, comes with a couple of libraries slowing down the initial application startup). Using EJB on the middle tier allows you to use batch mode, which reduces the number of roundtrips between the client and the server. Note that the default implementation is synchronous, which is more chatty.
    Frank

  • Referencing EJB 3.0 ,problem

    Hello I have 2 session EJB 3.0 and I would reference one on body of another , but
    I have an error form embedded OC4J when I run DEBUG .
    Here is my simply code
    TransactionController ---
    package com.savino.banking.model.facade;
    import com.savino.banking.model.entity.Transaction;
    import com.savino.banking.model.entity.TransactionItem;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless(name="TransactionController")
    public class TransactionControllerBean implements TransactionController,
    TransactionControllerLocal {
    @PersistenceContext(unitName="Model")
    private EntityManager em;
    public TransactionControllerBean() {
    public Object mergeEntity(Object entity) {
    return em.merge(entity);
    public Object persistEntity(Object entity) {
    em.persist(entity);
    return entity;
    and I declare a reference to TransactionController into AdminController :
    package com.savino.banking.model.facade;
    import com.savino.banking.common.exception.BusinessException;
    import com.savino.banking.model.entity.Cc;
    import com.savino.banking.model.entity.CostCenter;
    import com.savino.banking.model.entity.TypeTransaction;
    import com.savino.banking.model.entity.UserCcLinks;
    import com.savino.banking.model.entity.UserCcLinksPK;
    import com.savino.banking.model.entity.Users;
    import java.util.List;
    import javax.ejb.EJB;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless(name="AdminController")
    public class AdminControllerBean implements AdminController,
    AdminControllerLocal {
    @PersistenceContext(unitName="Model")
    private EntityManager em;
    @EJB(name="myController",beanInterface=TransactionControllerLocal.class,beanName="TransactionControllerLocal")
    TransactionControllerLocal controller;
    public AdminControllerBean() {
    And this is the error that I caught :
    25-giu-2008 20.03.46 oracle.j2ee.jndi.JndiMessages warningInvalidEJBReference
    AVVERTENZA: Impossibile risolvere il riferimento EJB "myController". La creazione di J2EEContext può tuttavia continuare.
    25-giu-2008 20.03.46 oracle.j2ee.jndi.JndiMessages warningInvalidEJBReference
    AVVERTENZA: Impossibile risolvere il riferimento EJB "myController". La creazione di J2EEContext può tuttavia continuare.
    25-giu-2008 20.03.53 oracle.wireless.its.ra.TelnetResourceAdapter run
    INFO: Avvio di Industrial Telnet Server versione: Version 10.1.3.0.0 completato.
    I am on JDev 10g 10.1.3.1, can anyone help me?
    thanks

    dupocate of : problem referencing EJB 3.0 ( injection)

  • Persist problem in cascade using @OneToMany

    We are trying to persist an object which has a OneToMany relationship to other objects with CascadeType.ALL
    When we persist, the log shows that it creates the INSERT statement with the correct bind variables (sequence-generated REPORT_ID, etc.) for the first object.
    The problem happens when it tries to cascade and insert the Many part. The log shows the it tries to create the INSERT statement for the second object but the bind variable for the REPORT_ID is null.
    Since we defined the relationship of the OneToMany using the REPORT_ID, we assumed that the REPORT_ID that was auto-generated for the first object would be used for the @Many objects.
    What are we missing ??????
    First Object:
    @Id
    @SequenceGenerator(name = "REPORT_HEADER_S", initialValue = 1, allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "REPORT_HEADER_S")
    @Column(name = "REPORT_ID", nullable = false)
    private Long reportId;
    @OneToMany(mappedBy = "report", cascade = { CascadeType.ALL})
    private List<Summary> summaryList;
    Second Object
    @ManyToOne
    @JoinColumn(name = "REPORT_ID", referencedColumnName = "REPORT_ID")
    private Report report;

    Hello, Chris.
    Thank you for your reply.
    The structure of my tables is:
    table document (id int not null constraint document_pk primary key,
    table document_price (document_id int not null constraint document_price_fk references document (id),
    date date not null default current_date,
    price decimal(9,2) not null,
    primary key (document_id, date)).
    The entity classes are:
    @Entity @Table(name = "DOCUMENT")
    public class Document implements Serializable {
    @TableGenerator(name = "document_generator", table = "ID_GENERATION", pkColumnName = "TABLE_NAME", valueColumnName = "ID_VALUE",
    pkColumnValue = "DOCUMENT", allocationSize = 1)
    @Id
    @GeneratedValue(generator = "document_generator")
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    // other fields
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "document", fetch = FetchType.LAZY)
    private Collection<DocumentPrice> documentPriceCollection;
    // constructors, getters, setters ...
    @PostPersist
    public void initializePrices() {
    for (DocumentPrice dp : documentPriceCollection) {
    dp.documentPricePK.setDocumentId(id);
    @Entity
    @Table(name = "DOCUMENT_PRICE")
    public class DocumentPrice implements Serializable {
    @EmbeddedId
    protected DocumentPricePK documentPricePK;
    @Basic(optional = false)
    @Column(name = "PRICE")
    private BigDecimal price;
    @JoinColumn(name = "DOCUMENT_ID", referencedColumnName = "ID", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Document document;
    // constructors, getters, setters ...
    @Embeddable
    public class DocumentPricePK implements Serializable {
    @Basic(optional = false)
    @Column(name = "DOCUMENT_ID")
    private int documentId;
    @Basic(optional = false)
    @Column(name = "DATE")
    @Temporal(TemporalType.DATE)
    private Date date;
    // constructors, getters, setters ...
    I create first Document entity, create DocumentPrice entity and add DocumentPrice entity to the documentPriceCollection of the first Document entity. I invoke commit method of my entity manager, and corresponding rows are added to the document and document_price tables.
    I invoke clear method of my entity manager.
    Then I create new entities Document and DocumentPrice and add new DocumentPrice entity to the documentPriceCollection of the new Document entity. I invoke commit method and get the following exception:
    oracle.toplink.essentials.exceptions.ValidationException
    Exception Description: Cannot persist detached object [entities.DocumentPrice[documentPricePK=.entities.DocumentPricePK[documentId=0;
    date=Sat May 29 00:00:00 MSD 2010];
    price=11]].
    Class> entities.DocumentPrice Primary Key> [2010-05-29, 0]
    at oracle.toplink.essentials.exceptions.ValidationException.cannotPersistExistingObject(ValidationException.java:2171)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:3251)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:339)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3220)
    at oracle.toplink.essentials.mappings.CollectionMapping.cascadeRegisterNewIfRequired(CollectionMapping.java:265)
    at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.cascadeRegisterNewForCreate(ObjectBuilder.java:1294)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3226)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:205)
    And I see through debugging that @PostPersist method of the Document entity isn't invoked during second commit before the exception is generated.
    What should I do to avoid exception during second commit?

  • EJB/JPA Session/Entity Bean: Back Reference Id not set

    Hello All,
    I m using JPA as a persist tool. I have an entity Account and in Account there is a collection of entity AccountDetail. In Account entity relation for AccountDetail is One-To-Many and in AccountDetail the relation for Account is Many-To-One. When i save the Account, object of Account and AccountDetail are saved correctly. But the problem is that in AccountDetail the Id of Account is not saved in Database table. I have AccountId in AccountDetail table. plz help me??
    Second thing is that how to generate automatically primary keys when entity saved in database ???

    define the column you want to auto increment as an Integer with Identity attribute set to True (using the sql server management tool for example) and then put
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    in front of the ID declaration in the mapping file, it should generate the IDs automatically.

Maybe you are looking for

  • Using a common library between two Mac accounts

    My wife and I are using our first Mac and taking/organizing pictures is a passion for both of us. Aperture is proving to be a great product, but one failing thus far is our ability to use a common Aperture library that we can use from both of our Mac

  • IP connectivity bug in Snow Leopard confirmed

    In order to make sure there are no disruptions on my laptop, I have created a Location 'Home' on which I set both my Ethernet and Airport settings manually to the same information. In my setup order, I put Ethernet as the top interface, followed by A

  • Skype won't sign in.

    When ever I try to sign in with my account with skype, it sticks at the moving circle, then it says Skype can't connect. I've tried >Re-Installing. >Resetting Internet Explorer & Updating. >Installing a old version of Skype. >Disabling fire-wall. >Re

  • Execute photoshop from indesign

    Hi scripters I have selection in my indesign document var myFigure = app.selection[0]; app.copy(); I have copied my selection image, now I want to open the photoshop and paste into new document this can be possible from indesign cs3 javascript? thank

  • Yoga 2 Bluetooth not stable with 7260 AC card

    Hi everyone, I'm having a problem with my Microsoft Wireless Bluetooth 8000 presenter mouse staying connected via Bluetooth.  I have installed the latest Kona Wifi driver and the latest Bluetooth driver from the Lenovo site.  It's my opinion that the