TOPLINK-6094: Mapping OntToMany (JPA)

Hello!
I'm learning how to use Java Persistence API and I'm getting an error which i don't know more what to do to solve it... :(
Exception Description: The parameter name [cdUsuar] in the query's selection criteria does not match any parameter name defined in the query.
Query: ReadAllQuery(sysgroups.entity.Profissao)
at oracle.toplink.essentials.exceptions.QueryException.parameterNameMismatch(QueryException.java:966)
at oracle.toplink.essentials.internal.expressions.ParameterExpression.getValue(ParameterExpression.java:206)
So, I'm mapping the tables User (USUARIO) and Jobs(PROFISSAO) in my entities like that:
Entities:
@javax.persistence.Entity
@javax.persistence.Table(name = "USUARIO")
@javax.persistence.NamedQueries( {
@javax.persistence.NamedQuery( name = "Usuario.findByCdUsuar",
query = "SELECT u FROM Usuario u WHERE u.cdUsuar = :cdUsuar"),
@javax.persistence.NamedQuery( name = "Usuario.findByLogin",
query = "SELECT u FROM Usuario u WHERE u.dsLogin = :dsLogin and u.dsSenha = :dsSenha"),
@javax.persistence.NamedQuery( name = "Usuario.findByNmUsuar",
query = "SELECT u FROM Usuario u WHERE u.nmUsuar = :nmUsuar"),
@javax.persistence.NamedQuery( name = "Usuario.findByDsLogin",
query = "SELECT u FROM Usuario u WHERE u.dsLogin = :dsLogin"),
@javax.persistence.NamedQuery( name = "Usuario.findByDsSenha",
query = "SELECT u FROM Usuario u WHERE u.dsSenha = :dsSenha")
public class Usuario implements Serializable {
@javax.persistence.Id
@javax.persistence.Column(name = "CD_USUAR", nullable = false)
@GeneratedValue(strategy=javax.persistence.GenerationType.SEQUENCE, generator="SqUsuario")
@SequenceGenerator(name="SqUsuario",sequenceName="SQ_USUARIO", allocationSize=20)
private BigDecimal cdUsuar;
@javax.persistence.Column(name = "NM_USUAR", nullable = false)
private String nmUsuar;
@OneToMany
@JoinTable(
name="USUARIO_PROFISSAO",
joinColumns=@JoinColumn(name="CD_USUAR", referencedColumnName="cdUsuar"),
inverseJoinColumns=@JoinColumn(name="CD_PROFI", referencedColumnName="cdProfi")
private java.util.List <sysgroups.entity.Profissao> profissoes;
// gets and sets...
@javax.persistence.Entity
@javax.persistence.Table(name = "PROFISSAO")
@javax.persistence.NamedQueries( {
@javax.persistence.NamedQuery(name = "Profissao.findByCdProfi", query = "SELECT p FROM Profissao p WHERE p.cdProfi = :cdProfi"),
@javax.persistence.NamedQuery(name = "Profissao.findAll", query = "SELECT OBJECT(p) FROM Profissao p"),
@javax.persistence.NamedQuery(name = "Profissao.findByDsProfi", query = "SELECT p FROM Profissao p WHERE p.dsProfi = :dsProfi")
public class Profissao implements Serializable {
@javax.persistence.Id
@javax.persistence.Column(name = "CD_PROFI", nullable = false)
private BigDecimal cdProfi;
@javax.persistence.Column(name = "DS_PROFI")
private String dsProfi;
// gets and sets
The tables are like that:
USUARIO
cd_usuar (PK)
nm_usuar
PROFISSAO
cd_profi (PK)
ds_profi
USUARIO_PROFISSAO
cd_usuar
cd_profi
And the error appears, for example, when i try to do something like that:
Usuario usuario = (Usuario)manager.createNamedQuery("Usuario.findByLogin").
setParameter("dsLogin",login.getLogin()).
setParameter("dsSenha",login.getSenha()).
getSingleResult();
if (usuario.getProfissoes() != null) { // OK
// Test
System.out.println("Nr Profissoes = "+ usuario.getProfissoes().size());
// ERROR...
enviroment:
netbeans 5.5 beta 2 Build: 200607190830, Ent. Pack 20060810
Sun Java System App Server 9
jdk1.5.0_05
Guys,
Sorry my poor english, but I hope u can get the idea.
Thanks a lot!

Hello,
The original posting seems to have defined the relationship mappings joinColumns incorrectly. For instance, in the case of :
joinColumns=@JoinColumn(name="CD_USUAR", referencedColumnName="cdUsuar"),
The referencedColumnName should refer to the Database table's Column name, not the object's property name. So USUARIO_PROFISSAO's CD_USUAR column should reference USUARIO's CD_USUAR column, not "cdUsuar" which doesn't exist.
Check to see your mappings are set up correctly as well.
Best Regards,
Chris

Similar Messages

  • Native mapping with JPA doesn't work by default - not marked cascade persi

    I started to use our old TopLink native mapping but via JPA instead of EclpseLink native API.
    But at first execution it's already complaining of my mappings. When using the native mappings shouldn't EclipseLink interpret it to keep old behavior?
    What are the other expected changes of behavior so that I can fix them proactively?
    What is the workaround for this specific problem?
    The error is:
    java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: Id: 0
    DateTime: Mon Jun 08 02:00:00 EDT 2009
    Entry Type: 10009
    Entry Type In/Out: 10014
    calendarDate: Mon Jun 08 00:00:00 EDT 2009
    businessDate: Mon Jun 08 00:00:00 EDT 2009
    origin: timecard
    Inserted: true
    Changed: false
    Deleted: false
    Mon Jun 08 02:00:00 EDT 2009.
         at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.discoverAndPersistUnregisteredNewObjects(UnitOfWorkImpl.java:4016)
         at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.discoverUnregisteredNewObjects(RepeatableWriteUnitOfWork.java:182)
    persistence.xml is:
    <persistence xmlns="http://java.sun.com/xml/ns/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">
         <persistence-unit name="AllInOne" transaction-type="JTA" >
         <description>This represent all CITYADM schema mappings. It does include pmsi.</description>
              <exclude-unlisted-classes>false</exclude-unlisted-classes>
              <properties>
                   <property name="eclipselink.session-name" value="AllInOne"/>
                   <property name="eclipselink.sessions-xml" value="sessions.xml"/>
              </properties>
         </persistence-unit>
         <persistence-unit name="DataServices" transaction-type="JTA">
         <description>This represent all REPORTADM schema mappings</description>
              <exclude-unlisted-classes>false</exclude-unlisted-classes>
              <properties>
                   <property name="eclipselink.session-name" value="DataServices"/>
                   <property name="eclipselink.sessions-xml" value="sessionsDataServices.xml"/>
              </properties>
         </persistence-unit>
    </persistence>

    Hello Sebastien,
    You are using em.persist instead of uow.regsiterObject, which has different behaviour as mandated by the JPA specification. EclipseLink/TopLink automatically registered referenced objects through registerObject, but the JPA specification states that persist will only cascade if the mapping is marked cascade persist - otherwise it is required to throw the exception you see.
    If you wish to use the JPA with a project defined through native api, you will need to modify your mappings to match how you want to use the API. In this case, to get the same effect as you would from registerObject, you will need to mark your mappings as cascade persist. Depending on how you merge your entities (shallow, deep etc) you might also need to evaluate how you plan to use the JPA merge method and mark mappings as cascade merge appropriately.
    See setCascadeMerge on ForeignReferenceMapping.
    Best Regards,
    Chris

  • Native Toplink to EclipseLink to JPA - Migration Best Practice

    I am currently looking at the future technical stack of our developments, and would appreciate any advise concerning best practice migration paths.
    Our current platform is as follows:
    Oracle 10g AS -> Toplink 10g -> Spring 2.5.x
    We have (approx.) 100 seperate Toplink Mapping Workbench projects (we have one per DDD Aggregate object in effect) and therefore 100 Repositories (or DAOs), some using Toplink code (e.g. Expression Builder, Class Extractors etc) on top of the mappings to support Object to RDB (legacy) mismatch.
    Future platform is:
    Oracle 11g AS -> EclipseLink -> Spring 3.x
    Migration issues are as follows:
    Spring 3.x does not provide any Native Toplink ORM support
    Spring 2.5.x requires Toplink 10g to provide Native Toplink ORM support
    My current plan is as follows:
    1. Migrate Code and Mappings to use EclipseLink (as per Link:[http://wiki.eclipse.org/EclipseLink/Examples/MigratingFromOracleTopLink])
    2. Temporarily re-implement the Spring 2.5.x ->Toplink 10g support code to use EclipseLink (e.g. TopLinkDaoSupport etc) to enable testing of this step.
    3. Refactor all Repositories/DAOs and Support code to use JPA engine (i.e. Entity Manager etc.)
    4. Move to Spring 3.x
    5. Move to 11g (when available!)
    Step 2 is only required to enable testing of the mapping changes, without changing to use the JPA engine.
    Step 3 will only work if my understanding of the following statement is correct (i.e. I can use the JPA engine to run native Toplink mappings and associated code):
    Quote:"Deployment XML files from Oracle TopLink 10.1.3 and above can be read by EclipseLink."
    Speciifc questions are:
    Is my understanding correct regarding the above?
    Is there any other path to achieve the goal of using 11g, EclipseLink (and Spring 3.x)?
    Is this achieveable without refactoring all XML mappings from Native -> JPA?
    Many thanks for any assistance.
    Marc

    It is possible to use the native/MW TopLink/EclipseLink deployment xml files with JPA in EclipseLink, this is correct. You just need to pass a persistence property giving your sessions.xml file location. The native API is also still supported in EclipseLink.
    James : http://www.eclipselink.org

  • Xml mapping with JPA error

    I am &#304;shak Teyran , the data manager of a team which attends to IBM XML Challenge Turkey, we are trying to build a dynamic web project in Rational Software Architect 7.5, WAS 7.0 , DB2 9.5 EE.
    the article of Vitor Rodrigues - http://www.ibm.com/developerworks/data/library/techarticle/dm-0901rodrigues/index.html - describes how to map xml to java using pureQuery however we need to do the same using JPA.. is there any difference?
    we are trying to achieve the same using JPA. but unfortunately we failed..
    for simplifying lets assume we have two tables , STUDENT ( id int, name char) and COURSES ( studentID int , and lessons xml) ... these two tables are related to each other with studentID foreign key... and we want to have student and courses java files where courses.java includes proper mapping to xml column lessons..
    i tried to make an .xsd file for xml column lessons.. and then i created its java file.. then i used JPA for creating student and courses java files but it always turns me a null pointer exception.. i dont know why.. and as result , only student.java is being created..
    i have tried following steps.
    My database connection and the tables are already present.
    1- i have created a new dynamic web site project, namely dene..
    from project facets i enabled dynamic web module, faces support (base, enhanced componnents) , Java Persistence, Javascript Toolkit, JavaServer faces, JSTL, Web 2.0 , Websphere Web(Co-existence),Websphere Web(Extended),Default Style Sheet facets.. and these facets musts be enabled for our project.
    2- i have created the CourseList.xsd and using -JAXB- i have created lessons.java
    3- i right clicked project and from the menu .. JPA tools->Generate Entities .. i choose connection and tables to generate entities but unfortunately no entity gets created ... when i only choose student table to generate the entity of, Student.java is being created however Courses.java always returns nullpointerexception..
    the stack trace of the exception is in the picture i attached.. here is its link.... [http://www.ibm.com/developerworks/forums/servlet/JiveServlet/download/430-250134-14212507-336353/hata.JPG]
    i have thought it might be because i use the openjpa and jaxb libraries of RSA.. and then i tried to load the latest versions of JAXB and openjpa .. i added all of their .jar files to the application classpath.. (if it is sufficient to add only openjpa-1.2.0.jar and jaxb-api.jar files let me know it please).. but this did not work neither..
    the only exception i get is :
    An internal error occurred during: "Generating Entities".
    java.lang.NullPointerException
    while creating lessons.java and the entity java files i am making sure that i give the same package name for both ... but i never succeeded creating courses.java..
    in RSA when i right click to project and go te JPA Tools menu there is a menu item "Configure Project for JDBC deployment" .. what is this for.. i have also tried using this and then trying to create entities but this failed too..
    then when they did not work ;
    i have decided to code the classes myself but in order to get things a little easier, i opened my DB and converted the XML column to a SMALLINT column .. just not an XML column... and then using JPA in RSA - i did not include openJPA jars in my project externally- i created the classes .. both Course.java and Student.java have been created well, because the column that was actually xml was converted to small integer..
    and if i add the related persistence and strategy lines :
    @Persistent
    @Strategy("org.apache.openjpa.xmlmapping.XmlValueHandler")
    to their proper places and editing the function and attributes data types and return types and then if i re-convert the column to XML data type in database, do you think it will work properly?
    so i really need a suggestion.. any help will be appreciated..
    what would you suggest?
    how can we achieve this goal for those two tables i mentioned above in RSA and using JPA ?

    Hi Tushar
    You will need to be more specific. Do you want an XML layout to use for importing or exporting SAP Business One objects? Maybe give us details of the specific object. Most DI API objects have a write to XML which will give you the layout for that object. You can also refer to the REFDI.CHM file under the SDK Help folder.
    Kind regards
    Peter Juby

  • How can i using datasource in toplink's map file

    In the TopLink map :
    <toplink:login xsi:type="toplink:database-login">
    <toplink:platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</toplink:platform-class>
    <toplink:user-name>test</toplink:user-name> <toplink:password>C23487CFA591952D44310804F3D591CB</toplink:password>
    <toplink:sequencing>
    <toplink:default-sequence xsi:type="toplink:native-sequence">
    <toplink:preallocation-size>1</toplink:preallocation-size>
    </toplink:default-sequence>
    </toplink:sequencing>
    <toplink:driver-class>oracle.jdbc.driver.OracleDriver</toplink:driver-class>
    <toplink:connection-url>jdbc:oracle:thin:@192.168.0.1:1521:testdb</toplink:connection-url>
    <toplink:bind-all-parameters>true</toplink:bind-all-parameters>
    </toplink:login>
    How can i modify it using datasource?

    The login information stored in the map file is good for direct connection and design time login information.
    For your runtime login information I would use the sessions configuration (sessions.xml). It provides complete deployment configuration:
       <session>
          <name>my-session</name>
          <!-- This references the ORM map XML file -->
          <project-xml>META-INF/employee-basic.xml</project-xml>
          <session-type>
             <server-session/>
          </session-type>
          <login>
             <datasource>jdbc/TopLinkDS</datasource>
             <uses-external-connection-pool>true</uses-external-connection-pool>
             <uses-external-transaction-controller>true</uses-external-transaction-controller>
          </login>
          <external-transaction-controller-class>oracle.toplink.essentials.transaction.oc4j.Oc4jTransactionController</external-transaction-controller-class>
          <enable-logging>true</enable-logging>
          <logging-options>
             <log-exceptions>true</log-exceptions>
             <print-thread>false</print-thread>
             <print-date>false</print-date>
          </logging-options>
       </session>Doug

  • How to use TopLink's mapping info at runtime

    Can anybody kindly instruct how to do the following:
    1) Once the "JavaSource.java" file or the "ProjectDeployment.xml" file is generated by TopLink from a TopLink project, how can it be included and used in a J2EE project at runtime? I understand that this step may be specific to the type of IDE used, let us say WebLogic, WebSphere or JDeveloper9i.
    2) Can TopLink generate the file "sessions.xml" automatically or it has to be hard-coded? Does this file have also to be included in a J2EE project under the directory of META-INF at runtime?

    Hi John,
    Probably the best way I can explain the process of putting a J2EE app with TopLink into production would be to describe the best practices of doing so.
    Firstly, I recommend using an IDE to develop your Java source code, although it is possible to generate Java source directly from the Mapping Workbench, this is considered more of a rapid prototyping or quick start process. Once the Java source has been compiled, the Meta-Data (project.xml) can be deployed from the Mapping Workbench.
    The next step really depends on the type of application you are creating. Since you are developing a J2EE based application and it will be multi-user, TopLink recommends using a ServerSession architecture. (Consult the documentation for detailed explanations). Configuring the session can be done in a number of ways, the best way would be to use the SessionManager and an external file called sessions.xml. Both the sessions.xml and project.xml must be visible by the J2EE component that will be using it. (Servlet/Session Bean, etc...). This is done through managing your deployment properly using something like an EAR.
    The key to getting the application and TopLink working together is the session, and here's a basic example on how you could set this up:
    sessions.xml code:
    <toplink-configuration>
         <session>
              <name>myProject</name>
              <project-xml>myProject.xml</project-xml>
              <session-type>
                   <server-session/>
              </session-type>
              <connection-pool>
                   <is-read-connection-pool>false</is-read-connection-pool>
                   <name>default</name>
                   <max-connections>10</max-connections>
                   <min-connections>5</min-connections>
              </connection-pool>
              <enable-logging>true</enable-logging>
         </session>
    </toplink-configuration>
    Somewhere in your application code, you might have a login method that makes use of the SessionManager to load and create the session:
    SessionManager sm = SessionManager.getManager();
              Server serverSession = (Server)sm.getSession("myProject", this.getClass().getClassLoader());
    The sessions.xml must be created manually at this point, a future version of the TopLink product will contain an editor which will help out.
    Darren Melanson

  • ConversionException in Toplink TIMESTAMP mapping

    We have a column mapped in Toplink as java.sql.Timestamp. In order to make this work they've added a few lines to the toplink Oracle.xml file defining the timestamp type.
    Inside JDeveloper this runs fine, however when run under Ant I get the following:
    EXCEPTION [TOPLINK-3001] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.ConversionException
    EXCEPTION DESCRIPTION: The object [oracle.sql.TIMESTAMP@258], of class [class oracle.sql.TIMESTAMP], could not be converted to [class java.sql.Timestamp].
    I've downloaded the newest JDBC drivers but the problem persists.
    Anyone have some advice?

    EXAMPLE CONVERSION MANAGER SOLUTION:
    package example;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import oracle.sql.*;
    import oracle.toplink.exceptions.ConversionException;
    import oracle.toplink.internal.helper.ConversionManager;
    * Example conversion manager that will add the ability to convert Oracle9i DB's
    * TIMESTAMP values into java.sql.Timestamp. This is required for TopLink
    * 9.0.3 and 9.0.4.
    * To use this class you must register the conversion manager prior to loading
    * your project.
    * <code>
    * ConversionManager.setDefaultManager(new MyConversionManager());
    * </code>
    public class MyConversionManager extends ConversionManager {
    private static final Class TIMESTAMP_TYPE = TIMESTAMP.class;
         protected Timestamp convertObjectToTimestamp(Object original) {
    if (original.getClass() == TIMESTAMP_TYPE) {
    try {
    return ((TIMESTAMP) original).timestampValue();
    } catch (SQLException se) {
    throw ConversionException.couldNotBeConverted(original, Timestamp.class, se);
    // NOTE: Similar check and comparisons could be done for TIMESTAMPTZ and TIMESTAMPLTZ
    return super.convertObjectToTimestamp(original);
    }

  • Toplink XML mapping: mapping choice

    I am doing a proof of concept and we try to use Toplink mapping without changing the original XML Schema.
    We use Toplink 10.1.3.
    The XML contains a child element defined as a complexType with a <choice>of 3 elements of type A, B or C.
    Those 3 elements do have some common properties and we wanted to map them as a collection of concrete Java classes A, B & C extending a common Abstract Java class.
    Any clue how we can do that?
    Robin

    Ok, I understand.
    So basically, I replace the [choice] with A,B or C in my schema by a [sequence] where A, B or C are with minOccurs=0.
    In my case, I have a collection of these choices.
    [choice minOccurs="1" maxOccurs="unbounded"]
    The problem is that there is a list of A, B & C elements which are unsorted.
    [root]
    [some child elements]
    [a]
    [c]
    [a]
    and so on
    In the schema, the list of A, B & Cs is represented by a choice with maxOccurs="unbounded".
    I can't figure how to express that in TopLink, if ever it is possible to handle this case.
    Thanks for your help.
    Robin
    Message was edited by:
    mulkers: I have replaced XML elements brackets by [] because the forum message editor was dropping them

  • TopLink : attribute-mapping direct-xml-type-mapping

    hi
    Using TopLink Workbench 10g Release 3 (10.1.3.0.0) Build 060118 it is possible to configure a "Direct to XML Type" mapping.
    see http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/relmapun004.htm#CHDFIFEF
    In the TopLink map this results in a
    <opm:attribute-mapping xsi:type="toplink:direct-xml-type-mapping">Is there a way to configure this kind of attribute mapping using JDeveloper?
    thanks
    Jan Vervecken

    Hi Paul,
    The problem you're going to hit trying to do this with a TransformationMapping in 904 (as in my other post) is that during the UnitOfWork commit, when TopLink is checking for changes a .equals will end up being called on an XMLType instance which will throw a NullPointerException (in oracle.sql.Datum I think).
    One way to work around this (depending on the requirements for your app) is to set the isMutable flag on the TransformationMapping to false. This flag indicates that the value in the object's attribute isn't going to be changed, so we don't bother trying to check to see if it's changed. This will allow you to do reads, inserts and deletes with no problems.
    The downside is that if you need to be able to change the XML content in your objects model and do an update of the row, TopLink will never detect a change and never issue an update of the XMLType field.
    Incidentilly, if you happen to hit the same issue you had with the DirectToXMLTypeMapping where you were getting back an instance of java.sql.Opaque instead of the expected oracle.xdb.XMLType from JDBC, you should be able to handle that case in your AttributeTransformer by doing
    XMLType myXML = XMLType.createXML(myOpaque)
    Document = myXML.getDocument();
    Hope this helps
    Matt MacIvor

  • Oracle Toplink Jaxb mapping

    Hi,
    i try to use the developer Preview 3(10.1.3.0)workbench
    and it work fine with simple java class (two xml files generation).
    But with java servlet who use the same classes nothing
    work i got some exception :
    05/03/01 08:24:33 exceptionProvider oracle.toplink.ox.jaxb.JAXBContextFactory could not be instantiated: java.lang.NoSuchMethodError: oracle.toplink.publicinterface.Session oracle.toplink.tools.sessionmanagement.SessionManager.getSession(oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader, java.lang.String, java.lang.ClassLoader, boolean, boolean)
    I have also a strange message in the log window in jdev 9052 :
    Cutting log (size: 101767, max: 100000)Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Cutting log (size: 101866, max: 100000)Error cleaning up log: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISeekableStream.seek]
    Thank you for your help.

    The version of TopLink on your application server class path may be an older version of TopLink that does not contain the method mentioned in the stack trace.
    If you are using OC4J the toplink.jar can be found in the following location:
    &lt;OC4J_HOME&gt;\toplink\jlib\toplink.jar
    The 10.1.3 DP3 version of OC4J can be found on OTN in the following location:
    http://www.oracle.com/technology/software/products/ias/preview.html

  • Toplink Missing  Mapping  - Jdeveloper 11g BUG-

    Hi ,
    I am generating two entities using JDeveloper 11g both Tables has 280 columns, I am using "entities from tables" wizard.
    For the first table it is generating the proper meta data like this one:
    @Id
    @Column(name="CLIENT_ID_DWH", nullable = false)
    private String clientIdDwh;
    @Id
    @Column(nullable = false)
    private String effectivefromdate;
    @Column(nullable = false)
    private String effectivetodate;
    @Column(name="HEDAAB_TXBRONC_DATE")
    private Timestamp hedaabTxbroncDate;
    @Column(name="HEDAAB_TXBRONC_EFFDT")
    private String hedaabTxbroncEffdt;
    @Column(name="HEDAAB_TXBRONC_QUAL")
    private String hedaabTxbroncQual;
    @Column(name="HEDAAB_TXBRONC_RCVD")
    private Long hedaabTxbroncRcvd;
    @Column(name="HEDAAB_TXBRONC_REASON")
    private String hedaabTxbroncReason;
    @Column(name="HEDAAB_TXBRONC_REQ")
    private Long hedaabTxbroncReq;
    @Column(name="HEDADD01_ADHDINIT_DATE")
    private Timestamp hedadd01AdhdinitDate;
    @Column(name="HEDADD01_ADHDINIT_EFFDT")
    private String hedadd01AdhdinitEffdt;
    @Column(name="HEDADD01_ADHDINIT_QUAL")
    private String hedadd01AdhdinitQual;
    @Column(name="HEDADD01_ADHDINIT_RCVD")
    private Long hedadd01AdhdinitRcvd;
    @Column(name="HEDADD01_ADHDINIT_REASON")
    private String hedadd01AdhdinitReason;
    @Column(name="HEDADD01_ADHDINIT_REQ")
    For the second table it is generating the following meta data for exampe:
    @Id
    @Column(nullable = false)
    private String clientiddwh;
    @Id
    @Column(nullable = false)
    private String cycle;
    @Id
    @Column(nullable = false)
    private String cyclemod;
    private Long hedisadhdmedfollowupinitiald;
    private String hedisadhdmedfollowupinitialdt;
    private Long hedisadhdmedfollowupinitialn;
    private String hedisadhdmedfollowupinitialop;
    private String hedisadhdmedfollowupinitialqu;
    private Long hedisadhdmedfolupcontd;
    private String hedisadhdmedfolupcontdt;
    private Long hedisadhdmedfolupcontn;
    private String hedisadhdmedfolupcontop;
    private String hedisadhdmedfolupcontqu;
    private Long hedisadolwellcarevisitsd;
    private String hedisadolwellcarevisitsdt;
    private Long hedisadolwellcarevisitsn;
    private String hedisadolwellcarevisitsop;
    This is totally not understandable, what is going on?
    A.B

    Hello,
    You might want to post this in the JDeveloper forums. For the second class, it just looks like the column names haven't been put into the generated class. This is only a problem if the defaulted column names would not match what is in the database - ie @Id String clientiddwh will default to use the "CLIENTIDDWH" field. Does this match what is in the table?
    Best Regards,
    Chris

  • What are the relation between JPA and Hibernate, JPA and TopLink?

    What are the relation between JPA and Hibernate, JPA and TopLink?
    Can JPA instead of Hibernate and TopLink?

    The Java Persistence API (JPA) is the object relational mapping persistence
    standard for Java. Hibernate and TopLink provide an Open source Object-relational mapping framework for Java.
    They provide an implementation for the Java Persistence API. In my opinion, both Hibernate and TopLink provide support to JPA
    and they can also be regarded as the complementary to JPA.
    Let's wait to see other person's opinions.

  • Toplink support for JPA vs. Toplink Essentials

    I think I read that Toplink has some support for EJB3/JPA as does Toplink Essentials.
    What is the difference in features?
    If one has a 10.1.3 app server license, should Toplink be used instead of Toplink Essentials for EJB3/JPA applications?
    Does the Mapping Workbench produce JPA object-relational mapping annotations or XML?
    Thank you.
    Richard Catlin

    Hi Robert,
    I'm not sure which comments you were directing specifically to Dali vs. JDeveloper but I'll try and address them from a Dali perspective. I do want to point out that Dali is at 0.5 and so it is still under development.
    yes you get a basic 1:1 entity from your databasetables...When generating Entities from tables, Dali will generate 1:1 and 1:many relationships based on database FK constraints.
    @temporary annotations are not inserted if you have a Date oder Calendar type.Also when generating Entities from tables Dali will generate an instance variable of java.sql.Date for a database date column. java.sql.Date does not require an @Temporal annotation.
    What's missing right now is a problem marker for missing @Temporal on java.util.Date and java.util.Calendar.
    If you want to rename attributes or methods it's a lot of manual work to do... because >@Column annoations are not inserted, if they do not exist because of >dbname=attributenameThere is a bugzilla bug opened for this refactoring support. https://bugs.eclipse.org/bugs/show_bug.cgi?id=136333 Fortunately in Dali if you rename a class or attribute (field/getter) and your explicit or default mappings are broken you will get a problem marking on the attribute and in the Problems view so you can fix it rather than finding out at runtime.
    generics are not inserted in the returnvalues of the methods...Generated Entities do use generics correctly e.g.:
    public class Publisher implements Serializable {
         @OneToMany(mappedBy="publisher")
         private Set<Title> titles;
         public Set<Title> getTitles() {
              return this.titles;
         public void setTitles(Set<Title> titles) {
              this.titles = titles;
    ...--Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Toplink 11 & JPA: advisable way going forward?

    Hi,
    We're considering the Toplink configuration choices of a new major information system.
    This system will not be in production for at least a year or more.
    I think we have a few options:
    - keep on using Toplink Workbench ORM 10.1.3
    - start using Toplink JPA 11. I get the impression that this is the preferred way forward for J2EE applications on Oracle AS. It makes me wonder whether all Toplink specific value added functionality, like historical queries f.i., will be available using this annotation based approach. Another concern obviously is how many problems we'll encounter because the product is in preview. Is it suitable for development yet? Will there be regular preview updates? Will Toplink 11 work under OC4J 10.1.3?
    - start using Toplink JPA 10.1.3. If I understand the documentation correctly this is an implementation of a preview of the JPA/EJB spec and is not recommended.
    - start using Toplink Essentials. I get the impression that this precludes us from using Oracle Toplink specific functionality like historical queries.
    Thanks for your advice.
    Regards,
    Joost

    Do I understand correctly that all Toplink specific functionality is available when using Toplink 11 JPA? Can you give me a clue how this will work? TopLink exposes its' functionality beyond the JPA specification in several ways:
    - Extended annotations are provided in the oracle.toplink.annotations package. These allow you to configure functionality like caching, locking and additional mappings not included in the JPA spec.
    - The TopLink sessions.xml and project.xml files can be used in place of the JPA orm.xml (or annotations), this gives you access to using the TopLink Mapping Workbench and all of TopLink's mapping functionality. You just need to set the sessions XML property in your JPA persistence.xml to do this.
    - You can customize your JPA generated TopLink descriptors or session using the DescriptorCustomizer or SessionCustomizer from your persistence.xml or using the @Customizer annotation.
    - You can cast your JPA EntityManager to the TopLink EntityManager interface, which exposes additional API. The JPA Query can also be cast to the TopLink Query interface. You can also access the underlying TopLink Session and DatabaseQuery from these to make use of any TopLink functionality that is not exposed.
    As you can imagine it's much harder organizationally to migrate server infrastructure to Oracle AS 11 then that it is to migrate the TopLink library used by an application. What is Oracle's policy in that respect? Oracle TopLink has always done its best to be portable across ALL application servers. It is our goal that TopLink 11g could be used in OC4J 10.1.3, and it should work, but I have not tested this myself.
    James Sutherland

  • Map XMLTyp Toplink Essentials

    hi,
    I'm been looking up info for a while now about XMLType. I found out that Toplink Essentials not directly supports XMLType but I managed to get it from the database. When I have got the object as an oracle.xdb.XMLType then I can read it, which is good, but now (when I alter it) i have to store it again. I use this to alter my XMLType:
        public static void main(String[] args) throws Exception{
            EntityManagerFactory emf = Persistence.createEntityManagerFactory("data");
            EntityManager em = emf.createEntityManager();
            em.getTransaction().begin();
            WebeMakrArtikel wma = (WebeMakrArtikel) em.find(WebeMakrArtikel.class, 1L);
            String newXmlString = "<newXml></newXml>";
            XMLType xml = wma.getArtikelXml();
            XMLType newXml = XMLType.createXML(xml.getJavaSqlConnection(), newXmlString);
            wma.setArtikelXml(newXml);       
            em.getTransaction().commit();
            em.close();
            emf.close();
        }But then i get this error :
    Exception in thread "main" javax.persistence.RollbackException: java.lang.NullPointerException
         at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionImpl.commit(EntityTransactionImpl.java:109)
         at oracle.toplink.essentials.internal.ejb.cmp3.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:45)
         at be.roularta.schrijf.Main.main(Main.java:19)
    Caused by: java.lang.NullPointerException
         at oracle.sql.Datum.equals(Datum.java:65)
         at oracle.toplink.essentials.mappings.foundation.AbstractDirectMapping.compareObjects(AbstractDirectMapping.java:286)
         at oracle.toplink.essentials.mappings.foundation.AbstractDirectMapping.compareForChange(AbstractDirectMapping.java:219)
         at oracle.toplink.essentials.descriptors.changetracking.DeferredChangeDetectionPolicy.createObjectChangeSetThroughComparison(DeferredChangeDetectionPolicy.java:124)
         at oracle.toplink.essentials.descriptors.changetracking.DeferredChangeDetectionPolicy.createObjectChangeSet(DeferredChangeDetectionPolicy.java:103)
         at oracle.toplink.essentials.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChanges(DeferredChangeDetectionPolicy.java:81)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:476)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1108)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:82)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:842)
         at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionImpl.commit(EntityTransactionImpl.java:90)
         ... 2 moreCan anyone help me to store this XMLType back in the database?
    Why does XMLType keep the connection anyway?

    XMLType is supported by EclipseLink which is replacing TopLink Essentials as the JPA implementation in GlassFish V3 and will be shipped in OracleAS/TopLink 11gR1. In addition to mapping XMLType columns into XML Strings or DOMs in the domain model the support also includes expression support so that
    SQLX queries can be generated.
    The solution in EclipseLink involves several classes working together to handle all of the reading, writing and querying capabilities so it not easy to point at a single piece of code to solve your problem.
    Doug

Maybe you are looking for

  • Dynamic path in the communication channel

    Hi, Is it possible to provide the path into the receiver file communication channel via the mapping program or any other means? In short, we want the path in the channel to be dynamic. Is it possible?, if so, how? Thanks, John

  • Mobile Time and Travel supporting Device types

    Hi Mobile Guru's, We would like to implement Mobile Time and Travel to our client. Currently they are using the PDA's. I have gone through installation guides of MTT and came to know that MTT is possible only for Laptops. Is my assumption is true? Pl

  • N73 vga camera question

    Hi,does anybody has the same problem as me > the 3g camera shows very bad quality and when i go to a dark place i see nothing,just blue dots?

  • WBS elements deletion

    I deleted some of the WBS elements a week ago. Now I still see them under the search list, Is it because they are marked for deletion and not deleted actually, If yes what should I do to remove them. Please reply.

  • Wwv_flow_security.authenticate

    I am using custom authentication scheme for my application - user names/passwords stored in a custom table and it all works fine. There is now a need for me to let a "workspace user" access this application i.e there is no such username in my custom