Transient Object with TopLink?

Can we create transient database objects with TopLink similar to the way we do with BC4J?
Eg: I can create a transient VO with BC4J with out a select query and add attributes to it. Can this be done with TopLink?

Any Help.

Similar Messages

  • Transient object to persistent

    Hi all,
    How can I make persistent a previously created transient object? I mean, is there any other way of making it persistent instead of executing method CREATE_PERSISTENT( attributes ) ??
    Maybe something like:
    MyTransientObject = Agent->Create_Transient( ... )
    MyTransientObject->MakePersistent( )
    Thanks in advance.

    Hi Jorge,
    what I was suggesting was to just call the create_persistent method with the attributes of the transient object except the business key. Then you will get a new business key for the persistent object. Then overwrite the reference to the transient object with the new persistent object reference.
    Something like this.
    MyTransientObject = Agent->Create_Transient( ... )
    MyPersistentObject = Agent->Create_Persistent( ... ).
    MyTransientObject ?= MyPersistentObject.
    Cheers
    Graham

  • Using transaction activation policy together with TOPLINK Java object/relational mapping "commit and resume" transaction?

    Has any one has experience using WLE transaction context together with TOPLINK Java
    version of "commit and resume" context?

    Has any one has experience using WLE transaction context together with TOPLINK Java
    version of "commit and resume" context?

  • Support for "transient properties" in Toplink

    Hi,
    (JHeadstart 9.0.4.5 with Toplink)
    When I add unmapped properties to the beans that are mapped through Toplink to the tables in my database, almost like transient attributes in BC4J View Objects, I run into a problem, caused by the
    <code>getAttributeAsString(Locale locale,String attributeName</code> method in oracle.jheadstart.model.toplink.handler.DataObjectImpl. In 9.0.4.5, this method was modified to cater for these situations, because previously such properties resulted in NullPointerExceptions. However, the current implementation - while not throwing exceptions - does not return the value of the transient property, which I would prefer it to do.
    My suggestions is to change the lines:
    <code>
    if (mapping==null)
    mLog.error("No Toplink mapping found for attribute " + descriptorClass.getClass().getName()+"."+newName);
    return "";
    </code>
    to:
    <code>
    if (mapping==null)
    mLog.error("No Toplink mapping found for attribute " + descriptorClass.getClass().getName()+"."+newName);
    return value;
    </code>
    best regards,
    Lucas Jellema
    AMIS Services

    Lucas,
    Thanks for the suggestion.
    We will look into it.
    Steven davelaar,
    JHeadstart Team.

  • Inserting a new row in a BC4J View Object with an attribute of type BFileDomain

    Hi all,
    I've to insert a row in a View Object with an attribute of type oracle.jbo.domain.BFileDomain.
    I do this within an Application Module's method, which has an input parameter of type byte[]. This parameter will be the content of the BFILE.
    What's the right way for doing that?
    I've tried with the following code, but I've got an exception in committing the transaction:
    public int serializeDocument(int codDomanda, int codSorgente, byte[] content, String est, int type, int cost, String title, String arg) throws JboException {
    int code = 0;
    //File f;
    DocumentiTwoView = getDocumentiTwoView();
    java.sql.Statement stmt = ((DBTransaction) getTransaction()).createStatement(1);
    try {
    Row docRow = DocumentiTwoView.createRow();
    SequenceImpl seq = new SequenceImpl("documenti_seq", getDBTransaction());
    Integer next = (Integer) seq.getData();
    code = next.intValue();
    docRow.setAttribute("Coddocumento", new Number(code));
    docRow.setAttribute("Titolo", (String) title);
    docRow.setAttribute("Argomento", (String) arg);
    docRow.setAttribute("Costo", new Number(cost));
    docRow.setAttribute("Tipo", new Number(type));
    docRow.setAttribute("Coddomanda", new Number(codDomanda));
    docRow.setAttribute("Codsorgente", new Number(codSorgente));
    //f = new File("Doc" + code + "." + est)
    BFILE src_lob = null;
    ResultSet rset = null;
    rset = stmt.executeQuery ("SELECT BFILENAME('DOC_DIR', 'Doc" + code + "." + est + "') FROM DUAL");
    if (rset.next()) {
    src_lob = ((OracleResultSet)rset).getBFILE(1);
    BFileDomain bfd = new BFileDomain(src_lob);
    bfd.setBytes(content);
    bfd.saveToDatabase(getTransaction());
    docRow.setAttribute("Contenuto", (BFileDomain) bfd);
    catch (Exception ex) {
    getTransaction().rollback();
    throw new oracle.jbo.JboException("Impossibile creare il nuovo documento:\n" + ex.getMessage());
    finally {
    try {
    stmt.close();
    catch (Exception nex) {
    try {
    // Commit the whole transaction
    getTransaction().commit();
    catch (Exception e) {
    e.printStackTrace();
    getTransaction().rollback();
    throw new JboException("Impossibile eseguire il commit della transazione:\n" + e.getMessage());
    return code;
    Thanks a lot in advance!
    Christian
    null

    Odd, have you disabled caching and indirection? (NoIdentityMap, dontUseIndirection, or alwaysRefresh/disableCacheHits). If so, then this could be the issue.
    Otherwise please include the sample code you use to perform this, and verify that you do not have any unusual code in your set/get methods or in descriptor events. Also turn TopLink logging on and include a sample. Also ensure that you do not modify your objects until after registering them in the unit of work, and only modify the unit of work clones.

  • Bad performance when using  complex database view with Toplink

    Hi
    Problem description
    1. I have a complex query that collects the data from many DB tables. For this reason I create a database view based on this select. Using EJB 3.0 with Toplink I
    mapped this view to a java object the same way I map database tables. The method I use to get the results is:
    snippet code...
    public List<VwKartela> VwKartela(Integer pperid) {
    List<VwKartela> results = null;
    Session session = getSessionFactory().acquireSession();
    ExpressionBuilder bankfile = new ExpressionBuilder();
    Expression exp1 = bankfile.get("perid").equal(pperid);
    ReadAllQuery query = new ReadAllQuery();
    query.setReferenceClass(VwKartela.class);
    query.setSelectionCriteria(exp1);
    results =(List<VwKartela>)session.executeQuery(query);
    When running the select on the view prom SQL Plus I haven’t any performance problem.
    2.Question: How can I improve the performance? I referenced to Toplink docs but I didn't improve the it.
    Have anyone any experience is such cases?
    Thank you
    Thanos

    Hi
    After my last tests I conclude at the followings:
    The query returns 1-30 records
    Test 1: Using Form Builder
    -     Execution time 7-8 seconds
    Test 2: Using Jdeveloper/Toplink/EJB 3.0/ADF and Oracle AS 10.1.3.0
    -     Execution time 25-27 seconds
    Test 3: Using JDBC/ADF and Oracle AS 10.1.3.0
    - Execution time 17-18 seconds
    When I use:
    session.setLogLevel(SessionLog.FINE) and
    session.setProfiler(new PerformanceProfiler())
    I don’t see any improvement in the execution time of the query.
    Thank you
    Thanos

  • Getting the full value out Jdeveloper when used with Toplink.

    Hi guys. Okay, I am going to show my ignorance of Toplink and maybe even Java!
    But, I don't understand the toplink mapping process. I have done some tutorials on OTN that have me use the Table-to-Object wizard on Jdeveloper. That worked great.
    But now as I use my own real database, the tables have forgein key relationships between multiple tables and such. When I tired the same excercise with these tables, I get a crazy StackOverflowError when I try to run my test app.
    I notice that when I create the Objects at the same time, there are collections and links put in between the classes, but when I do them one at a time, I get just POJOs basically.
    So what I don't understand is, Am I supposed to bring my objects to Toplink, already created and oriented to each other?
    And what are all those links between classes when I use the wizard?

    I was looking for the exact version to have the engineers review what might have caused the issue. 10.1.3 developer preview 4 has been thoroughly tested and we have not been able to get a stack overflow exception during the POJO generation from tables.
    I would like to get a schema creation script that we could use to reproduce this issue. I can be contacted at douglas.clarke at oracle.com.
    Doug

  • Which is better ? Toplink Java objects or Toplink Entities ?

    Hi
    We are planing to use Toplink JPA that comes with JDeveloper 11g preview release
    I have a question here!
    I would like to get clarified which is better to use :
    1. Toplink Java Objects from Tables ,
    2.Toplink Entities from Tables
    Could you suggest the best approach, and pros and cons of both the approaches?
    Thanking you ,
    Samba

    Samba,
    Ultimately both are using the same TopLink runtime. In the case of Entities you are using JPA and Java Objects you are using TopLink native API and metadata.
    Going forward I would recommend JPA with TopLink extensions as required.
    Doug

  • How to map a collection of object in TopLink?

    For (simple) example, I've a XSD that defines:
    <xsd:complexType name="AttachmentType">
    <xsd:sequence>
    <xsd:element name="docID" nillable="false" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="MyDocType">
    <xsd:sequence>
    <xsd:element name="attachment" nillable="true" minOccurs="0"
    maxOccurs="unbounded" type="tns:AttachmentType"/>     
    </xsd:sequence>
    </xsd:complexType>
    This XSD is referenced by a WSDL. Using JDeveloper to generate a Java Web Service using the WSDL and will get the following classes:
    public class AttachmentType implements java.io.Serializable
    protected java.lang.String docID;
    public AttachmentType() {    }
    public java.lang.String getDocID() {        return docID;    }
    public void setDocID(java.lang.String docID) {        this.docID = docID;    }
    public class MyDocType implements java.io.Serializable
    protected AttachmentType[] attachment;
    public MyDocType () {    }
    public AttachmentType[] getAttachment() {        return attachment;    }
    public void setAttachment(AttachmentType[] attachment)
    this.attachment = attachment;
    Now I want to generate a XML document from MyDocType. I use TopLink (JAXB) to do the mapping. However, how to map the 'attachment' of type AttachmentType[]? TopLink seems only allowing List/Set/Collection container options.
    Anyone can help?
    Note: I have to use the classes generated from WSDL.
    Thanks!!

    Thanks. I'm using TopLink Workbench for the mapping
    and have no idea on how to specify the XML
    transformation mapping for array attribute. Can you
    tell me more?I was putting together an example of the transformation mapping but came up with a better way. It turns out that a transformation mapping isn't ideal because you have to take over some of the responsibility for converting XML to objects. A better solution is to intercept the calls to the getter and setter for the AttachmentType[] and convert between an Array and List. Just map the Array as a composite collection in the workbench and customize the attachment attribute mapping in code.
    Each mapping in TopLink has Accessor object responsible for getting and setting values in objects. If you choose method or direct access the mapping will have a different Accessor class. So the solution is to use an Accessor that converts the List TopLink builds into an Array of the correct type on set. On get, the Accessor creates a List from the Array.
    You can introduce a custom Accessor using an After Load method. I've put a complete example up on my googlepages account[1]. The key code is listed below. Note that this code assumes you're using direct instance variable access. Also, this code works with TopLink 10.1.3.2 and the TopLink 11 preview. It won't work with previous versions.
    The After Load class that changes the mapping accessor:
    public class MyDocCustomizer {
         public static void customize(ClassDescriptor descriptor) {
              XMLCompositeCollectionMapping mapping = (XMLCompositeCollectionMapping)
                   descriptor.getMappingForAttributeName("attachment");
              InstanceVariableAttributeAccessor existingAccessor =
                   (InstanceVariableAttributeAccessor) mapping.getAttributeAccessor();
              ListArrayTransformationAccessor transformationAccessor =
                   new ListArrayTransformationAccessor(AttachmentType.class, "attachment");
              transformationAccessor.initializeAttributes(descriptor.getJavaClass());
              mapping.setAttributeAccessor(transformationAccessor);
    }The custom InstanceVariableAccessor subclass:
    public class ListArrayTransformationAccessor extends
              InstanceVariableAttributeAccessor {
         private Class arrayClass;
         public ListArrayTransformationAccessor(Class arrayClass, String attributeName) {
              super();
              this.arrayClass = arrayClass;
              this.setAttributeName(attributeName);
         public Object getAttributeValueFromObject(Object anObject)
                   throws DescriptorException {
              Object[] attributeValueFromObject =
                   (Object[]) super.getAttributeValueFromObject(anObject);
              return Arrays.asList(attributeValueFromObject);
         public void setAttributeValueInObject(Object anObject, Object value)
                   throws DescriptorException {
              List collection = (List)value;
              Object[] array = (Object[]) Array.newInstance(arrayClass, collection.size());
              for (int i = 0; i < collection.size(); i++) {
                   Object element = collection.get(i);
                   Array.set(array, i, element);
              super.setAttributeValueInObject(anObject, array);
    }--Shaun
    http://ontoplink.blogspot.com
    [1] http://shaunmsmith.googlepages.com/Forum-519205-OXM-Array.zip

  • Transient Object in Appliaction Service

    Hello *,
    I have three Entity services:
    one for product data from PLM -> external,
    one for price data from SD -> external,
    one for additional data -> local.
    These three services I'd like to aggregate in one application service (PriceObject) which is remote enabled and accessible as a Web Service.
    When my GUI or any other application wants to have a PriceObject, they call my PriceObjectService with material data (key) as input and get a complete PriceObject (including data from all three entity services).
    Normally, if I add entity services as dependencies to my application service it can just return one of the entity services in operations tab.
    So I think my question is:
    How can I realize a transient object as application service which aggregates entity services and returns the aggregation?
    Thanks in advance and best regards
    Joschi

    Hello Joachim,
    Unfortunately there is no way to create a custom "Aggregate" output Data Structure which would hold these 3 Entity Services.  You can create custom data structures, but there are no options for Entity types.  You should be able to create an output Data Structure that holds 3 object references, but then the client would have to look up each entity by it's service interface.
    Did you build Entity relationships for all 3 of these Entities?  If so, then you can return one from your PriceObject and then the client can navigate to the other 2 through the generated getEntity() methods.
    Maybe the best option would be to create a complex Data Structure which basically mimics the aggregate structure of your three Entities.  In your PriceObject application service method, you would have to copy over the data from the 3 Entities into the new Transient data structure.
    Regards,
    Austin.

  • How to add a new object to Toplink session cache?

    Toplink Experts,
    I have a question on Toplink 9.0.4.5 (I know this is older version of Toplink but this is what we are using right now). Let me give you little context before I ask the question.
    Toplink server session brokers client sessions (that are spawned by it) and gets changes made in client sessions into server session through transaction commits. Process involved in getting some thing into database using Toplink is: 1) Get client session 2) Register object to be written into database with Toplink's UnitOfWork (UOW). This registration creates two copies of the object registered (original object). Working clone for client application for modifications, backup clone for Toplink to compare the changes made to the working clone later 4) Make changes to the working clone 5) Complete the transaction (and so commit UOW). If transaction commits successfully, Toplink writes the changes from the working clone into database first and applies the same changes made to the working clone to the original object in Toplink server session cache next. Oracle recommends using UOW to write some thing into database. Using UOW involves a transaction and it writes changes into database first before the original object in Toplink server session cache is refreshed.
    Now comes my question: Is there a way to add a brand new object (persistent object) into Toplink server session cache with out writing it first into database? I am OK if I need to use UOW and also to use transaction to make the change but I just want to be able to refresh the original object in the server session cache with out writing any thing into database. If there is a way to do this? What are the disadvantages in doing this way though? I have read Oracle's Toplink developer guide (10.1.3) and Javadocs from Oracle on UnitOfWork/Session etc all related interfaces and classes but I could not find a way. Please help!
    Syam

    There are a couple things wrong with the method you posted. The first being uow.registerObject() is going to cause the object to be treated as new if you are not using the TopLink cache.
    There really is not any supported mechanism to do what you are looking to do. TopLink 11g has the hooks to replace the TopLink cache with a distributed cache (and the TopLink-Grid product uses these to use Coherence as the TopLink cache) but earlier versions did not have this.
    If you are willing to work outside what would be officially supported and no component of the application is using the ServerSession cache (ie all queries refresh) then something like the following may work for you:
    public void prepareObjectForSave(Object userEditedObject, Object gigaSpacesObject)
    UnitOfWork unitOfWork = this.dbContext.getSession().acquireUnitOfWork();
    Descriptor descriptor = this.dbContext.getSession().getDescriptor(gigaSpacesObject);
    Object pkVector = descriptor.getObjectBuilder().extractPrimaryKeyFromObject(gigaSpacesObject, this.dbContext.getSession());
    Object cloneOfMostRecentlyUpdatedObject = (Object)unitOfWork.cloneAndRegisterObject(gigaSpacesObject, new CacheKey(pKVector), descriptor);
    unitOfWork.mergeCloneWithReferences(userEditedObject);
    unitOfWork.commit();
    }You will need to tweak the above code to have it match the APIs in your version of TopLink and you should test thoroughly.
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to store a  blob with toplink

    Hi .. I am using toplink 10g (10.1.3.0) and oracle9 and I am trying to insert a blob with toplink in the database but I dont know how I need to use a resultset and a PreparedStatement if it is the case hor how use toplink???

    You should be able to read the file in and convert its data to a byte-array in your object. TopLink will handle the conversion from byte-array to BLOB in the database.
    If you are using the Oracle thin JDBC drivers, they have a 5k size limit, if your file is larger than this you will need to use the Oracle8/9Platform in your login and a TypeConversionMapping and set the fieldClassification to java.sql.Blob.

  • ABAP  Object  - Persistent Services -  Transient Objects

    Hi,
    can anybody give an example of when I might want to use a transient object in the persistent services?
    Cheers
    Andrew

    Hello Andrew,
    Generally ABAP programs work with data and objects that are valid at
    runtime. They are transient i.e. temporary and disappear when program ends.
    To store this data permanently and independently of the program context,
    it must be stored in the database. Persistent Services in ABAP Objects can be used to write the current values of objects defined as persistent to associated transparent tables. Later these values can  be retrieved from the tables. In this way an object oriented database management system can be simulated.
    Regards
    Indrajit.

  • My problem with Toplink upgrade from 2.5.1 to Release 2

    Hi:
    I met some confusions in upgrading our system from TOPLINK2.5.1 to TOPLINK Release 2(Oracle9.0.3).
    And because I didn't use TOPLINK tools before this project, I spent one week to know the structure of our system. Unfortunately, Our company isn't a supported Oracle customer. We just bought Oracle product, didn't buy support service.
    First of all, I'll describ our system structure. The system is Weblogic5.1 + Toplink 2.5.1 + Oracle8.1 .Using Toplink we mapping our EJB to Oracle. The results of this procedure aremany .table, .descriptor, .topclass under the mapping forlder, and weblogic-ejb-jar.xml, topling-cmp-XX.xml, ejb-jar.xml under the deploy forlder. That's all.
    So, after our ant-build, we copy these results to Weblogic server directory, and compile with EJB, deploy them. It's correct?
    OK, as my considering, I install TOPLINK Release 2 , use Renamer tool to rename my source code from old TOPLINK library to oracle.toplink, complie them again. And create new project in TOPLINK 9.0.3 , import classes, login Database correctly. Do mapping as in TOPLINK2.5.1. Generate packagename.ClassDescriptor.xml under Descriptor, forlder ClassRepository, Class, Table, Database generate xml files also.
    Do the above process correct? OK, let's assume it' correct. But how can I modify my ant-build , you know the structure is difference between Weblogic 5.1 and Weblogic 6 or 7. Additionally, I don't know where should I copy new TOPLINK library to Weblogic directory. Yes, I know old TOPLINK library location, but I think it has difference.
    So , please tell me I can use Weblogic5.1 + TOPLINK 9.0.3 + Oracle 8.1 , is it right? I will be appreciated if you can give me some detail steps in upgrading TOPLINK.
    And perhaps we need to upgrade out system from TOPLINK 2.5.1 to TOPLINK 4.x first?
    Thanks for your view.
    Yours
    Denver Yang
    Software Engineer

    Hello Denver,
    If you are using CMP Entity Beans then TopLink 903 supports WebLogic 6.1 and 7.0. You would have to upgrade your WebLogic version at the same time you upgrade TopLink.
    If you are using Java Objects (not CMP Entity Beans), then you can use any version of any app server with TopLink.
    If you migrate from 2.5.1 to 903, you can send your project to support and they will update it. If you are not a supported customer, then you will have to do this manually (meaning you will have to remap in 903 from brand new).
    You are correct that your build process will be different when you migrate, but this will be because of how WebLogic has changed deployment and how the EJB spec has evolved moreso than anything to do with TopLink. How to do deployment in 903 should be in the TopLink 903 docs.
    Hope this helps,
    - Don

  • Howto call custom Oracel Data Type with TopLink?

    Hello,
    in our DB we have a custom Oracle type and a PL/SQL method which uses it.
    I would like to call the Oracle data type with TopLink. How can I do this?
    I could not find any documentation on this.
    I know JPublisher can do this but I don't want to use it!
    Please see code below
    cheers,
    Pete
    **************Datatype********************************
    CREATE TYPE My_Sub_Object AS OBJECT (Sub_Object_ID Number,
    Sub_Object_Txt VARCHAR2(200));
    CREATE TYPE My_Sub_Objects AS VARRAY (20) OF My_Sub_Object;
    CREATE TYPE My_object AS OBJECT (Object_id Number,
    Object_txt VARCHAR2(200),
    Sub_Objects My_Sub_Objects);
    ************PL/SQL-Method*****************************
    CREATE OR REPLACE PROCEDURE My_object_pro
    (Item_Object out My_Object) is
    Item_Sub_Object My_Sub_Object;
    Item_Sub_Objects My_Sub_Objects;
    Begin
    Item_Sub_Object := My_Sub_Object(10, 'Sub Object 10');
    Item_Sub_Objects := My_Sub_Objects(Item_Sub_Object);
    Item_Sub_Objects.Extend;
    Item_Sub_Object := My_Sub_Object(11, 'Sub Object 11');
    Item_Sub_Objects(2) := Item_Sub_Object;
    Item_Object := My_Object(1, 'Object', Item_Sub_Objects);
    End;
    /

    Object types and Varrays can be used from TopLink stored procedure calls. There was some support for this in 10.1.3, but the support in 11g (preview) is much better. You can also access the JDBC connection from TopLink or your DataSource and use JDBC directly.
    In TopLink 11g you can use an ObjectRelationalDescriptor to map the Object type to a Java class, and use this class as the argument type in your StoredProcedureCall.
    PL/SQL types are more difficult as they are not supported by JDBC, but your example only includes object types. If you had PL/SQL types you would need to wrap the types in object types, or use a PL/SQL block to convert them. TopLink 11g (preview 3) should have support for these as well.

Maybe you are looking for

  • Is this a bug in FF67?

    Hi, After upload electronic bank statement (without posting) to the system using FF.5, we use FF67 to view the statement status. Initially it displayed as "Elec.", after viewing some other statement, it status changed to "Elec. Posting complete". Whe

  • URL retrieval from a JSP

    Hi,           I've gotten everything working in our cluster except this. We have some           JSP's that retrieve resources via a URL that points back to the cluster.           i.e. the JSP retrieves an xml template from the server and then populat

  • Acrobat 9 Pro - Converting PDF to JPEG

    I had to reinstall my acrobat 9 pro after my hard drive had to be reformatted. When it was installed previously on my old hard drive, I never had issues with converting a pdf file to a jpeg.  Since the new installation that option does not work anymo

  • Most recently uploaded iphoto videos not showing up in imovie

    when i try to use iphoto videos in my imovie project, the most recently uploaded videos do not show up. this has happened to me before, and i got around the issue by importing the original video files (through finder) into imovie. the clips that were

  • Advantage of fal_client/fal_server in 9.2.0.7 ?

    Hi I have been setting up standby databases, and just have a (hopefully) stupid question ... What is the advantage of using the fal_client/fal_Server over automatic gap resolution in 9.2.0.7. As all my gaps seem to get resolved without the fal* param