TopLink Troubles

I've been trying to working with UML modelling and TopLink and been having a few problems.
I want to be able to create a class that may span more than one table. Typically I would use a BMP Entity bean but I find this too slow for our needs.
Can I actually do a 1 object to many tables mapping using TopLink? So far the examples I've tried all base the process from a database to code process whereby classes are just generated from a table - not the direction I'm trying to develop from.
To clarify, I want to create a UML diagram to assist in creating a class and database diagram and then ensure my classes can be "mapped" to the right tables - not necessarily a 1 to 1 (class to table) relationship.
Any ideas on where to get this kind of info?
Regards,
Anthony

Try to first create a set of Java classes from your diagram.
If you don't want 1-to-1 mapping to tables, you might want to use the database diagramer to design and generate your tables structure.
Then you can use the toplink meet in the middle scenario which is meant for cases where the classes and tables were defined each on their own.
Basic steps:
Right-click the TopLink Mappings node in the Structure Pane and select Add or Remove Descriptors... from the context menu.
Add the classes you have.
Right-click the TopLink Mappings node in the Structure Pane and choose Automap from the context menu.
In Step 1 of 3 in the Automap Wizard, select Import Database Objects... from the drop down list. This invokes the Import Offline Database Objects wizard.
Follow along the wizard from that point on.
More about toplink mapping is in the JDeveloper online help.
And you can also try the toplink forum on OTN:
TopLink/JPA

Similar Messages

  • Trouble installing Toplink 10

    I have followed the instructions on how to install Toplink and when I double click on workbench.cmd, I get the following errors:
    "Windows cannot find '-Xmx128m'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search"
    So, I commented out the line that set the JVM_ARGS, as it is optional anyway.
    Unfortunately, when i do that, it gives me a new error:
    "Windows cannot find '-cp'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search"
    How can I get past these errors? I have tried deleting and reinstalling toplink multiple times with no luck.
    any help would be appreciated.

    I believe you may be having problems with the JAVA_HOME and JDBC_LIB variables in the setenv.cmd/sh script not being configured.
    Link to instructions
    Doug

  • Multiple Rows Update / Refresh Toplink Query when database trigger involved

    Hi everybody!
    I have two easy troubles for you; the platform is the same as the SRDemo Toplink version.
    1.     Multiple Rows Update: I want to update with mergeEntity method, multiple rows for an isolated table; that method receives a parameter that I try to bind with the iterator "dataProvider" but it only merges the first row, not all, any other combination returns an error.
    What I want to do is to have a form (like tabular forms in Apex) that lets me update multiple rows in a single page. ¿May anyone tell me how to do it?
    2.     Refresh Toplink Named Query: I have a list on a page with two columns. From another page, a button does an action that fires a database trigger that updates one of the columns on the list´s page. When I go back to the list, it is not updated; however, the CacheResults´s property is set to false on the iterator.
    Thanks in advance,
    Alejandro T

    I didn't use it (yet), but - you might take a look. You'll find a [url http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-plug-ins-182042.html]Timer plug-in on this page. It is a dynamic action which allows you to periodically fire other dynamic actions in the browser. For example use the timer to refresh a region every five minutes. You can perform any dynamic action you want using this infrastructure.So I was thinking: you might use it to run a dynamic action which would check whether something changed in that table (I suppose you'll know the way) (for example, a database trigger might set a flag in some table, timestamp or similar), and - if you find that something really changed - refresh the page.
    As I said, I never used it so that's pure theory. Someone else might know better, though.

  • DirectMapMapping on Toplink 10.1.3

    Hi,
    I am trying to map my EJB bean which has a property list that I am using directMapMapping to this property table using hashmap and having trouble compiling with weblogic.ejbc. It gave me this error.
    c:\maranti\msm\src\com\maranti\msm\server\objectRepository\ejbcgen\com\maranti\msm\server\objectRepository\ProvisionPolicy_nyxaeb__TopLink_CMP_2_0.java:361: setCollectionAttribute(java.util.Collection,java.util.Collection) in oracle.toplink.internal.ejb.cmp.PersistenceManagerBase cannot be applied to (java.util.Hashtable,java.util.Hashtable)
    getPersistenceManagerTopLink).setCollectionAttribute(this.properties, propertiesArg);
    I look inside toplink.jar and could not find similar method that accept Hashtable which is the properties attribute that I am trying to map.
    Does Toplink 10.1.3 support HashMap or is this a bug or maybe I am missing something. Here is my mapping
    DirectMapMapping propertiesMapping = new DirectMapMapping();
    propertiesMapping.setAttributeName("properties");
    propertiesMapping.dontUseIndirection();
    propertiesMapping.setReferenceTableName("CARD_PROPERTIES");
    propertiesMapping.setDirectFieldName("CARD_PROPERTIES.VALUE");
    propertiesMapping.addReferenceKeyFieldName("CARD_PROPERTIES.CARD_ID", "CARD.ID");
    propertiesMapping.setKeyClass(String.class);
    propertiesMapping.setValueClass(String.class);
    propertiesMapping.useMapClass(java.util.Hashtable.class);
    propertiesMapping.setDirectKeyFieldName("CARD_PROPERTIES.NAME");
    descriptor.addMapping(propertiesMapping);
    Thanks for any help you can provide.
    -T Nguyen

    This error is occurring because you have defined the Map field as a cmf in your CMP ejb-jar.xml. Map is technically not a supported collection type in CMP, you should be using a non-cmf or cmr (just a normal variable) instead of abstract get/set methods for this attribute.
    I have also logged this issue internally, as we should either be handling this case, or throwing a better exception. Thanks for reporting this issue.

  • NullPointerException when running TopLink

    Hi. I'm working through the ADF tutorial for JDeveloper. I keep running into a NullPointerException when I try to complete the TopLink step
    java.lang.NullPointerException
         at oracle.ideimpl.log.TabbedLogManager.getMsgPage(TabbedLogManager.java:101)
         at oracle.toplink.addin.log.POJOGenerationLoggingAdapter.updateTask(POJOGenerationLoggingAdapter.java:42)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.fireTaskUpdated(MappingCreatorImpl.java:1102)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:269)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:206)
         at oracle.toplink.addin.wizard.jobgeneration.JobWizard$1.construct(JobWizard.java:401)
         at oracle.ide.util.SwingWorker$1.run(SwingWorker.java:119)
         at java.lang.Thread.run(Thread.java:595)
    If I click OK, the JDeveloper shows a dialog box as if it's doing some work. This just runs indefinitely and never does anything. I've tried the tutorial a couple of times with the same problem at this step. Help!! I'm getting very frustrated and don't know what's going on.

    Thanks for your reply, user640530. No, this is XP Pro. It seems to be having trouble from the Java class connecting to the db; however, the db connection by itself works fine. Not sure what to do next. Help!!

  • TopLink JPA join problems.

    I need a bit of help here, I hope someone can give me a few pointers...
    I've been building out an Object Relational mapping in TopLink using the bean-style interfaces. On one of my objects I have a 1:M relationship to another table, so
    One Key in T1 -> >1 Keys in T2.
    Pretty simple really. I'm doing it like this:
    @JoinTable( name=, etc. etc.)
    private Set<ObjectForTable2> variableName.
    When I call the getVariableName() method, I get back an IndirectSet (as a set) from the method as expected; however, the size of this set is either 0 or 1.
    In Table 2 I have approximately a dozen rows which correspond to the join key, and when I run the query toplink is building in my SQL shell, I get back the dozen rows. When TopLink does it, I only get to see the first row. Is there some other trick I need to use with the set returned? Right now when I call mySet.size() on the Set returned from getVariableName() I get a size of 1 or 0. (I only get 0 if I change the key to one that does not exist in table 2.)
    if I use the iterator method, such as
    for ( final Iterator i = mySet.iterator(); i.hasNext(); ) {
    ObjectForTable2 myObj = (ObjectForTable2)i.next();
    System.out.println( myObj.getXXX() );
    I still only get one result out. Help! What am I doing wrong here? Do I need to configure something to pull back more than one record from the database?
    Also, how does one use the Oracle bugtracker for this open-source product, if I don't have a service contract?
    Thanks,
    Robbie

    Exactly.
    In TopLink (and in JPA in general) you need identify the field, or combination of fields that are used to uniquely identify entities. As Doug mentioned, it is most common that these fields are the PK of the database.
    Based on your response above I assume that you had a non unique field mapped as the PK of the enitity. This could cause the trouble you are experiencing. Mapping the pk to a unique field (or combination of fields) will likely solve this problem.

  • Point Toplink map to exactly same schema but differnt schema

    Hi all,
    We want to point our Toplink mapping which is generated using a test schema to "real data schema" which has exact same structure.
    Is it possible to do it.?
    May be it will make more sense if I say, we want to edit WSDL of Database adapter and expect same adapter to go to the new schema connection (which we put there after editing the wsdl).
    I hope I explained and its the right place to ask the question.
    thanks in advnace

    Hi there,
    the best place to ask DBAdapter questions is probably Integration - Adapters.
    Integration - Adapters
    If in design time you create your database connection with one username but import tables belonging to a second username, then the toplink-mappings.xml will contain explicit schema references. This can cause troubles switching from development to production.
    At this point best thing you can do is edit toplink_mappings.xml and search and replace i.e. "SCOTT." with "". That will reduce any qualified table references in that file with unqualified ones, i.e. SCOTT.EMP -> EMP.
    If your (subsequent) problem is at runtime logging in as one user but wanting to interact with tables belonging to a second user, then in application-deployments/default/DbAdapter/oc4j-ra.xml, and in connectors/DbAdapter/DbAdapter/META-INF/ra.xml you could configure the property tableQualifier="<secondUserName>". However you will still need to make sure there are no explicit schema references in toplink_mappings.xml before this advanced 'tableQualifier' setting can take effect. This 'tableQualifier' setting was what Doug was referring to.
    Thanks
    Steve

  • JPA/Toplink changes the query logic

    Hi,
    Iam currently using JPA with Toplink implementation , i guess that toplink has its own way of optimizing the provided JPA query ; on another words , toplink sometimes changes the way you are using joins and exists statement to what looks optimized , but unfor. this caused me troubles tracking a query that should work on a certain way but its not cause the generated query by Toplink ( can be captured on the log ) does not represent the same logic , is this a known issue or do i have to write my JPA query on a way on which can be translated correctly by toplink , i know i should provide the query it self , but the model structure is too complex.
    Thanks in advance

    Hello,
    JPQL does not directly translate to SQL, so there might be some differences in what you may be expecting due to JPA requirements on the results that are returned. If there is a problem with specific queries, please let us know and file a bug if it is not behaving the way it should. A workaround would be to use a native SQL query directly.
    Best Regards,
    Chris

  • Urgent, Please Help - Toplink & ADF Memory Problem

    Hi all,
    We are using ADF Rich Client, Toplink11g, Oc4j11g. EJB tier is implementing with SessionBeans using Toplink with Database operations. And BackedBeans for serverside.
    Users search records and then update them or create record. For examples user enters cardno in first page and in second page access the user informations. And updates info. Then goes back to first page.
    Maybe while going back to first page some toplink objects still referenced with another objects.
    i am calling a toplink finder method it returns 10-20 rows and showing on a table these records using method iterator. Users select a row and continue with selected row. At the other page the user modify the data and turn back the search page.
    I took heap memory dump of server and i saw that 10 objects in memory.In every search and going edit page this count is increasing. In addition i saw cached objects in memory. There is no problem my toplink cache configuration. But i am not using caching with the other object.
    I am just calling finder method in a backed bean,without using table and method iterator there is no object in memory.
    Is the problem beacuse of adf pgae life cycle?
    I am really in trouble.
    Thanks to all.
    gokmeni

    Go to Menu>Tools>File Manager>Options>Memory details, this will give you a run-down of how much phone memory is free and how much is used, then a breakdown of where the memory is being used. Your phone memory is about 140Mb in total (don't confuse this with the 8Gb - that's just "Mass memory" for storage of data like music, video and pictures plus it is possible to install some apps in there. The phone memory is used for processing as well as sotrage, which is why you get these errors if too much is used.
    In the breakdown, you'll see the following items:
    - Calendar: this should only be a few Kb, perhaps a few hundred Kb if you use the feature often, but not too much
    - Contacts: should also be measured in Kb, even if many of your contacts have images
    - Messages: should be measured in Kb, if it goes into Mb or worse still Gb then you have Bluetooth of MMS messages hogging space - save the attachments to mass memory and delete the messages.
    - Images, videos and soundclips should not be large - perhaps a small number of ringtones, images that you use as backgrounds etc. but the bulk of these media files are best moved to mass memory.
    - Documents should be tiny, keep documents in mass memory.
    - MIDP (Java) apps and SIS (Symbian) apps could be filling space, you might be able uninstall some of these and reinstall them to mass memory if needs be, but be aware that some apps must be in phone memory and that some of the space taken by SIS apps will be preinstalled stuff that you can't move.
    If none of the above can explain the memory full erros and you do seem to have a large amount of Mb free, then it could be a software issue that can be solved by reformatting the phone with the code *#7370# - make sure that you use PC Suite Content Copier to backup important data first, and after the reformat when you restore the backed-up data, don't include settings in the restoration and also leave out any data types that you know you don' use.

  • [JPA] Invalidate TopLink Essentials' L2 cache. How?

    Hi,
    I'm trying to invalidate the L2 cache of TopLink Essentials. In Java SE, I try something like this:
         Customer cust = em.find(Customer.class, 1L);
         System.out.println(cust);
         em.clear();
         em.close();
         em = emf.createEntityManager();
         Session session = ((EntityManagerImpl)em).getSession();
         session.getIdentityMapAccessor().invalidateAll();
         cust = em.find(Customer.class, 1L);
         System.out.println(cust);The trouble is that only ONE SQL statement is generated, not two, as I would have expected.
    In Oracle Application Server, I cannot even get this far because I cannot cast to EntityManagerImpl. There, the class hierarchy is:
         com.evermind.server.ejb.persistence.EntityManagerProxy
                implements com.evermind.server.ejb.persistence.ContainerEntityManager
         com.evermind.server.ejb.persistence.AbstractEntityManagerProxy
                implements javax.persistence.EntityManager
         java.lang.ObjectSo, how can I do this in Java SE and in a container?
    Best regards,
    Bisser

    Hello Bisser,
    getSession() only returns the active session (the underlying UnitOfWork) if one is available or null if not. Use getServerSession() instead.
    As for in the container, you need to call getDelegate() to get the wrapped entitymanager.
    Best Regards,
    Chris

  • TopLink Access Synonyms

    Hi
    I hava an application that is using TopLink, ADF and JSF. I hava an schema and mappings to that schema, and everything is working right. Now i need to access objects from another schema wich i have access to through synonyms
    How can i do this ??
    thanks a lot

    I'm having trouble reproducing the issue you're seeing.
    I started with our test database, which includes ADDRESS and EMPLOYEE tables related by a foreign key constraint. I have created synonyms for both ADDRESS and EMPLOYEE. I then started the Jave Objects from Tables wizard (Business Tier > TopLink).
    On page 2 of 4 (select tables), I selected the synonyms that I had created. I accepted all defaults from there, and completed the wizard.
    My TopLink Map didn't contain any mapping errors. The relationship mappings between my descriptors looked fine, and it picked up the PK information from the underlying tables.
    I opened the editor for my descriptors (by double clicking "AddressSynonym" for example, in the structure pane), and I see a complete listing of my columns under primary keys.
    Is your test case different from what I've tried?
    Thanks,
    -Billy

  • Deploying jdeveloper's jsf toplink ejb application to jboss4.0.4

    hi java/j2ee developers,
    we developed a application using jdeveloper ide using jsf,toplink and ejb technologies, when we deploying this application to jboss4.0.4 application server we are getting the following exception
    org.jboss.deployment.DeploymentException: Failed to parse WEB-INF/web.xml; - nested throwable: (org.jboss.deployment.DeploymentException: expected one local-home tag)
    at org.jboss.web.AbstractWebContainer.parseMetaData(AbstractWebContainer.java:749)
    at org.jboss.web.AbstractWebContainer.init(AbstractWebContainer.java:356)
    if anybody knows how to solv e this one, please give us the reply as soon as possible,Thanks In Advance.we are waiting for your kind information.Thank you once again.

    Basically I started to develop this system inside Oracle AS and then when it came time to passing a request to a new page, it crapped out on me on the App. Server. So instead of trying to fix the problem there and then I continued to develop outside Portal and inside Jdeveloper. After a week or two once all my stuff worked perfectly I try and take it back into Portal but only the first JSP of all my Portlets would show up, because as soon as I would submit a form and the action directed me to a new page and Portal would be lost/confused. Obviously I shouldn't have done it that way but none the less...
    So now I'm reading through the documentation you pointed me towards and it seems I have to qualify my parameters and then "attach" them to the url which the form will pass to the actioned page. I'm importing numerous classes (...urlUtils, etc) in order to qualify the parameters and then build this url without affecting any parameters currently present that my portlet does not own.
    What I'm rambling towards here is all this separation of logic and presentation and the whole nine, implies different people can develop different parts of a 'system' mostly independant of one another...so in my situation I shouldn't in huge trouble yet, since underlying everything is a working system. My issue is with oracle and the App Server. If I take my code which works great outside of the App. Server and I fully qualify parameters and make sure my form actions are constructed using the UrlUtils in order to fully qualify them as well, and then I make sure page parameters are mapped to the proper portlet parameter values....should my system work on the App Server (assuming everything is done properly)....or am I still missing something.

  • Using an Oracle SQL Function from JPA/TopLink

    How do I get the return value from a simple (one string input parameter, returns a string) Oracle SQL Function?
    Thanks!

    If you mean calling a stored function in Oracle, you might try something like:
        ValueReadQuery vrq = new ValueReadQuery();
        SQLCall call = new SQLCall("begin ###res := pkg.funcInp(#inp); end;");
        vrq.setCall(call);
        Query q = em.createNativeQuery("");   // we need a Query; any query would do; we replace its contents below
        ((EJBQuery)q).setDatabaseQuery(vrq);
        q.setParameter("inp", "paramValue");
        String result = (String)q.getSingleResult();
        // #=input; ###=output; ####=input/output;
        // if you want to explicitly specify the type of an output parameter, use #### instead of ###,
        // because pure "output" parameters are always treated as java.lang.StringThis will only work in TopLink Essentials, though. I don't know how to do it in Hibernate. I have dealt mainly with TopLink, and just a little with Hibernate.
    In my opinion, it's a HUGE omission not to have support for stored procedures in JPA. Virtually every project I have worked on (in two large companies) has consisted of a large portion of code in stored procedures (sometimes as much as 50% of the overall code). It's a pain to have to go through all that trouble to call the stored procedures.
    Also, pay special attention to TopLink's shared L2 cache. If a stored procedure changes something in the database, TopLink won't know about it and chances are that you will end up with stale objects in the cache which you will either have to refresh, or you'd have to invalidate TopLink's cache for these objects.
    Best regards,
    Bisser

  • Trouble getting a timestamp formatted by a 'to_char' function

    We have trouble getting a timestamp formatted by a 'to_char' function and a 'group by'
    for a count. By assigning the result of the to_char function to an attribute and
    grouping on that attribute, we try to get the frequency of an event.
    What happens is a non predictable 'IllegalArgumentException' on
    'Timestamp.class' while getting the timestampvalue.
    We make use of a scrollablecursor as you can see in the stacktrace.
    java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
    at java.sql.Timestamp.valueOf(Timestamp.java:160)
    at oracle.sql.CHAR.timestampValue(CHAR.java:567)
    at oracle.jdbc.driver.ScrollableResultSet.getTimestamp(ScrollableResultSet.java:658)
    at oracle.toplink.oraclespecific.Oracle9Platform.getObjectFromResultSet(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.getObject(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.fetchRow(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.cursorRetrieveNextRow(Unknown Source)
    at oracle.toplink.queryframework.ScrollableCursor.retrieveNextObject(ScrollableCursor.java:512)
    at oracle.toplink.queryframework.ScrollableCursor.loadNext(ScrollableCursor.java:357)
    at oracle.toplink.queryframework.ScrollableCursor.hasNext(ScrollableCursor.java:233)
    After restarting the application server there is a chance that the query returns
    with the expected results. But most of the times it just returns the above
    mentioned exception.
    I don't see the logic in the apparently random parsing of the value.
    The column in the database is a timestamp, but that the reason why i'm using the
    to_char method.

    This is a bug in TopLink with ReportQuery. Please report this is Oracle technical support. Basically TopLink is converting to the attribute type, but should not be if a function was applied to the expression.
    To workaround the issue you can use getField(/) in the expression instead of get(/) (using the database field name instead of the class attribute name).

  • ADF Faces - Resons about use TopLink

    Hi everyone!
    I'm writing to yours because I want to make a document giving reasons about to use TopLink technology instead other technologies.
    Where do I get that information..??..
    I'll be waiting your responses.
    Regards.

    Just be prepared to deal with LOTS of XMLs, sometimes depending on each other, sometimes in a chain of dependencies. For example, you'll have Page Definition files (XMLs), related to DataBindings.cpx (XML), related to DataControls.dcx (XML), related to Data Controls (XMLs), etc. There will be also several other XMLs. Declarative programming has its benefits too, but it also has some downsides.
    The real trouble is that the Java compiler regards the XMLs as plain text files. If you make a change in a method signature via automatic refactoring, for example, the XMLs will remain unchanged (i.e. will become invalid) but will not report compile-time errors. When you run the application, you'll eventually notice that some things don't work anymore, but quite often the framework's log is empty or insufficient. So, you know something is wrong but you don't know what or where. You may spend many hours scouting throughout the XMLs trying to find one single letter somewhere that is wrong but that didn't get detected at compile time.
    There are nice things about ADF Faces and the rest of ADF. You can even force some of the XMLs to be re-generated automatically after you make a change, e.g. the Data Controls. But because of much bad experience, XMLs are universally disliked in our team. If only there was at least some XML syntax checking and validation at compile time, so that we could see the exact errors...

Maybe you are looking for