Mapping using Java coding

I have a great difficulty. First of all, I'm doing the mapping using Java coding based on the TopLink Developer's Guide.
I use the employee Table as usual, but that is the problem, I can not insert on the database once I do the mapping. As a note, there is no compilation error and also I can do the session connection already.

Employee.Java
Employee/public class extends oracle.toplink.sessions.Project {}
Private Long id;
private String fnama;
private String lnama;

Public Employee() {}
setName ("ObjectTab");
applyLogin();
addDescriptor (empDesc ());
conformAllDescriptors();
}

public String getFnama() {}
Return this.fnama;
}

public String getLnama() {}
Return this.lnama;
}

{} public void setFnama (String fnama)
This.fnama = fnama;
}

{} public void setLnama (String lnama)
This.lnama = lnama;
}

public void applyLogin() {}
DatabaseLogin connection = new DatabaseLogin();
Use the appropriate for the underlying database platform
() login.usePlatform
new oracle.toplink.platform.database.oracle.Oracle9Platform ());
login.setDriverClassName ("oracle.jdbc.OracleDriver");
login.setConnectionString("jdbc:oracle:thin:localhost:1521:pusat");
login.setUserName ("tryo");
login.setEncryptedPassword ("one, CODED");
Configuration properties
setDatasourceLogin (login);
}

public empDesc() {} ClassDescriptor
Descriptor ObjectRelationalDescriptor = new ObjectRelationalDescriptor();
descriptor.setJavaClass (Employee.class);
descriptor.setTableName ("EMPLOYEES");
descriptor.setStructureName ("EMPLOYEE_T");
descriptor.setPrimaryKeyFieldName ("ID");
descriptor.addFieldOrdering ("ID");
descriptor.addFieldOrdering ("F_NAME");
descriptor.addFieldOrdering ("L_NAME");
descriptor.addDirectMapping ("id", "OBJECT_ID");
descriptor.addDirectMapping ("fnama", "What");
descriptor.addDirectMapping ("lnama", "L_NAME");
return the descriptor;
}

}


Main class:
protected String getSessionsXmlPath() {}
Return "sessions.xml";
}

protected String getSessionName() {}
return "Session."
}

protected void createSession() {}
XMLSessionConfigLoader loader = new XMLSessionConfigLoader (getSessionsXmlPath ());
Bishop SessionManager = SessionManager.getManager ();
session = (DatabaseSession) mgr.getSession (loader, getSessionName(), Thread.currentThread () .getContextClassLoader (), true, true);
}

public static closeSession() Sub {}
SessionManager.getManager () .destroyAllSessions ();
session = null;
}

Private Sub jButton1_actionPerformed (ActionEvent e) {}
Employee myEmp = new Employee();
createSession();
}

Private Sub jButton2_actionPerformed (ActionEvent e) {}
Employee theEmp = new Employee();
UOW UnitOfWork = session.acquireUnitOfWork ();

try {}
theEmp.setFnama ("A");
theEmp.setLnama ("B");
UOW.Commit ();
} {Finally
UOW. Release();
}

}

For everyone who already knows the solution please reply as soon as possible. Because I really need this solution to finish my last final project.
Thank you

When you create a new instance, you must register with the UnitOfWork in order to have the new entity has persisted.

Employee theEmp = new Employee();
UOW UnitOfWork = session.acquireUnitOfWork ();

theEmp.setFnama ("A");
theEmp.setLnama ("B");

uow.registerObject (theEmp);

UOW.Commit ();

Doug

Tags: Fusion Middleware

Similar Questions

  • Creation of mapping using Java - SDK - 12 c ODI ODI

    Hello

    I would like to know the JAVA API and sample code in JAVA to create a new map to 12 c inside an ODIProject.

    Please let me know the way to do this.

    Kind regards

    Dheeraj

    Has managed to create the dataset in 12 c and map. . Below are the sample extract.

    Thank you all!

    Import oracle.odi.domain.mapping.Mapping;

    Import oracle.odi.domain.mapping.component.Dataset;

    .

    .

    .

    Mapping map = new map ("MyOdiMap", fold);

    MyOdiInstance.getTransactionalEntityManager () .persist (map);

    dataSet = map.createComponent ("DATASET", "DEFAULTDATASET") (Dataset);

  • In general, is it better to use java.sql.Date and java.sql.Timestamp instead of oracle.jbo.domain.Date?

    Hello world

    During playback of Oracle ADF Real World Developer's Guide, I noticed the dates match occurring in JDeveloper is different from what is the list in the book. JDeveloper is failing to oracle.jbo.domain.Date, but according to the book:

    DATEjava.sql.DateDATE type is mapped to java.sql.Date if the column in the table is a no time didn't need information zone.
    DATEjava.sql.TimestampDATE type is mapped to java.sql.Timestamp if the column in the table has a component "time" and that the client needs to zone information.
    TIMESTAMPjava.sql.TimestampThe TIMESTAMP type is mapped to java.sql.Timestamp if nanosecond precision is used in the database.

    In general, is it better to use java.sql.Date and java.sql.Timestamp instead of oracle.jbo.domain.Date? Using java.sql.Date and java.sql.Timestamp could save me some headaches conversion date. And, is there a place in JDeveloper to display these maps? I looked around and didn't see anything.

    Thank you.

    James

    User, what version of jdev we are talking about?

    In GR 11, 1 material versions db types date and timestamp are mapped to types of domain data that represents a wrapper for the native data types. The reason was that the framework can work with the domain types regardless of the underlying data type.

    Since Oracle 11 GR 2 maps the types DB to java types (default selection, you can change it when you create a model project, you can set the Data Type Mapping). Once the pilot has business components define you cannot change this setting it would break existing components such as eo or vo.

    So if you are working wit 11 GR 1 subject, you must use the domain types, if you work with GR 11, 2 or 12 c, you can use the domain types, but it is recommended to use the java type mapping.

    Timo

  • How to remove all catalogs org using java sdk

    I am trying to remove all the catalogs of organization that I wrote for the catloges of org in this loop even not able to use the code below
    Admincataloge it is by exception, if someone help me as this code to remove the catalogs in the Organization, it's greate for me help.  I'm new java coding this code not structured.

    If

    (! organizationsMap . isEmpty())

    {

    ReferenceType organizationReference =

    organizationsMap .get (OrganizationName);

    System.

    on . Print (OrganizationName);

    System.

    on . println();

    System.

    on .println (organizationReference.getHref ());

    Organization is organization. getOrganizationByReference (

    vcloudClient , organizationReference);

    Collection < ReferenceType > catalogLinks = organization.getCatalogRefs ();

    if (! catalogLinks.isEmpty ())

    {

    for (CatalogLink ReferenceType: catalogLinks)

    {

    Catalog category = Catalog. getCatalogByReference (

    vcloudClient , catalogLink);

    CatalogType catalogType = catalog.getResource ();

    System.

    on .print ('-' + catalogType.getName ());

    System.

    on . println();

    System.out.println ("-" + catalogLink.getHref ());

    } System of.

    on . println();

    }

    on the other

    System.

    on .println ("no catalog found");

    }

    else {

    System.

    on .println ("No organization");

    System. output (0) ;

    }

    Hello

    You need to go to the VcloudAdmin and then iterate over the AdminOrganizations and its AdminCatalogs to remove the catalogs.

    You can do something like this.

    Access the admin of Vcloud.

    Admin of VcloudAdmin = vcloudClient.getVcloudAdmin ();
    Iterate through the admin organizations.
    {for (adminOrgRef ReferenceType: {admin.getAdminOrgRefs ())}
    AdminOrganization adminOrg = AdminOrganization.getAdminOrgByReference (vcloudClient, adminOrgRef);
    Browse the catalogues of the admin.
    {for (adminCatRef ReferenceType: {adminOrg.getCatalogRefs ())}
    try {}
    Delete the catalog.
    AdminCatalog.delete (vcloudClient, adminCatRef);
    System.out.println ("Catalogue deleted-" + adminCatRef.getName ());
    } catch (VCloudException e) {}
    System.out.println ("Delete Catalog Failed-" + adminCatRef.getName () + "-" + e.getLocalizedMessage ());
    }
    }
    }

    Kind regards

    Rajesh Kamal.

  • How to get the parameter ITResource to itResourceName using java?

    Hi all
    I need to get itResourceParameters as the server address, port, login, administrator etc. from itResourceName in java.

    I had checked the api and found the interface

    tcITResourceInstanceOperationsIntf Intf = (tcITResourceInstanceOperationsIntf) tcUtilityFactory.getUtility ("Thor.API.Operations.tcITResourceInstanceOperationsIntf");

    But I have problems to use it. It always throws errors. I'm not good at java coding to help you please.

    Is thank you

    public Hashtable getITResourceParameters (String, tcDataProvider ioDatabase resource) throws Exception {}
    Config ConfigurationClient.ComplexSetting = ConfigurationClient.getComplexSettingByPath ("Discovery.CoreServer");
    final Hashtable env = config.getAllSettings ();
    tcSignatureMessage moSignature = tcCryptoUtil.sign ("xelsysadm", "PrivateKey");
    tcUtilityFactory tcUtilityFactory = new tcUtilityFactory (env, moSignature);
    Hashtable resourceHash = com.thortech.xl.util.adapters.tcUtilXellerateOperations.getITAssetProperties (ioDatabase, resources);
    log. Debug ("resourceHash size:"+ resourceHash.size () ');
    Return resourceHash;
    }

    After that, you can use Hashtable operations to retrieve the hash values.

  • I downloaded Safari 10 and now every page that uses Java asks me to activate or not. How to avoid this new feature? I have problems to access my bank account.

    I downloaded Safari 10 and now every page that uses Java asks me to activate or not. How to avoid this new feature? I have problems to access my bank account.

    I think they mean JavaScript.

    In your Safari menu bar, click Safari > Preferences and then select the Security tab, and then select: Enable JavaScript

  • Run the jar using Java 7?

    My Macbook Pro currently runs on Java 8, and I want to start a specific jar (minecraft associated) that supports only Java 7, is there a way I can run the file using Java 7 through terminal. I can share the script starting current I use here - http://pastebin.com/XEq01mdZ - the jar file is called cauldron.jar.

    Thank you for your help.

    I don't have any Java installed for an exact string to show you, but each version of Java is installed in its own folder. You can call this version of Java by specifying the full path to the particular version.

    The java_home command will show you what JVM you have installed with the path to each House.

  • You say don't not to use Java, but when I remove it, I just can't see vedios and things don't work properly. So, if I cancel Java I use.i

    Explain to us whether to use Java. ? If she isent safe for our games and coupons and videos that which must be loaded on the computer to make these things work. ? Damed if we do and damed if we do not have. People who are not computer and get older, how do you know how. We need 1 2 3 4 steps. After I update you, I started getting pop ups, especially since a Web Guard, I tried to take off and fought with him for 1 1/2. My computer wouldn't work. I have Avast security and when these security companies we safe. And these cleaner companies, other things, try to take over the computer. If you pay or you pay not it's the same, everyone wants to take control of your computer. I don't have a TV, my computer is important to me. And then the computer when I try to enter read something special on an e-mail, it begins to roll said empty in the box and just keeps circling. Unfortunate I need free things to download to help me and then the things I try something underhanded coming on the tail and destroy my computer. Not in the position to hire Nerds to fix.

    The Java security problems is Java Deployment Toolkit.
    Not all Java programs.

    Java downloads for all operating systems

  • Impossible to use Java 64 bit install for mozilla?

    Firefox is disable the installation of Java Java 7 u4, so I uninstalled it and I try to get Firefox to recognize the u17 of Java 7 64 bit already installed or install u17 Java 7 32-bit. But when I try to install jre-7u17-windows - i586.exe that it fails. You can one of these problems solved so I can use Java in the browser?

    I just uninstalled then immediately reinstalled the latest Mozilla Firefox and went into the appdata\Mozilla directory and install to erase everything in-between sets.

    When I search support on "Wizard was interrupted", I find these tips, you probably saw:

    Error: The wizard was interrupted before Java (TM) 6 update could be completely installed.

    This page includes links to an Installer 'offline' 30 MB. I guess that their theory is that the problem is related to the use of their stub Installer.

    Note: If the old Java will not uninstall, there may be a registry problem. I saw a recommendation for this Microsoft 'Fixit' in this case: http://support.microsoft.com/mats/Program_Install_and_Uninstall/

  • Satellite L300 - 12K - Skype disconnects when surfing and using Java

    Hello!

    I always have problems when I use Skype when you surf in particular using java and don't know why.
    When I start a conversation on Skype, I m always disconnected from the internet. No more connection for 1 or 2 minutes.

    Only when you use Skype. The problem is not the connection but computer. Are there settings to be defined?

    CPU: L300 - 12K
    Browser: IE
    Vista

    Thanks in advance.

    Hello!

    It s not that easy to tell what the reason is for this...
    Are you using the new version of Skype and Java? Visit the site of the factory for an update.

    You have this problem using LAN or WLAN connection?
    Maybe you should try to update the driver.

    Good bye

  • "The specified network folder is currently mapped using a different user name and password", trying to connect to a remote drive.

    Original title: the specified network folder is currently mapped using a different user name and password.__To to connect using a different user name and password, first disconnect any existing mappings to this network share.

    I am trying to connect to a remote drive. I clicked to map the drive, entered the name of the drive, came the name of login/password for the computer turns on and then it give me this error message: the specified network folder is currently mapped using a different user name and password. To connect using a different user name and password, first disconnect any existing mappings to this network share.

    In Windows 7 Enterprise, I would like to point out that, if you map \\server1\share1 as drive letter X using "user1" and "password1", then try to map \\server1\share2 (a different share) as drive letter Y using the same ID "User1" and "password1" and you select 'connect using different credentials' in the dialog box connect a network drive and specify the id "User1" and "password1". you will get this error MESSAGE INCORRECT that says 'the specified network folder is currently mapped using a different user name and password'.

    The message is bad because:

    1. the specified network (action2 in my example) folder is not mapped at all, and

    2. the server (in my example, "server1") is already mapped (to a different and different drive letter share) using the SAME user name and password.

    The error message is wrong in two respects.

    This let me puzzled for a while until I realized that once you have mapped to 'Server1' using the credentials, you can map to different actions on the same server without re - specify the credentials.  It is NOT CLEARLY the 'Map network drives' dialog box, which leads to users (like me, and I'm a programmer by trade) trying to enter credentials again and this incorrect error message.

    David Walker

  • 'The specified network folder is currently mapped using a different user name and password'.

    "The specified network folder is currently mapped using a.
    another user name and password.
    Connect using a different user name and password
    First, disconnect any existing mappings to this network
    share '.
    I got this message when trying to access a laptop on my home network. It's a laptop which came for years. The only change that occurred was the removal of a few videos to Windows Media Player. In fact, I was sitting near the laptop (laptop 1) that stores the video & audio files that I share on my network for years and an additional (cell 2) laptop computer on my network. I was simply remove a playlist via WMP and I witnessed portable 2 lose access to files I had shared for years with my home network. I don't even use WMP, I had just open trying to access the laptop 1 video/audio files to my PS3 system. I was clear an old list of video of WMP so I could add the extra avi files to the list that I had collected over the years. I wanted to not double many videos so I removed the videos in WMP list. Since then, I'm not able to share anything of my laptop 1 to the rest of my network. I did not like WMP before, now I really despise WMP. When I try to share a folder, right click, share with & click on homegroup (read/write), the option is not selected. Any solution would be greatly appreciated. Thank you

    Hello

    The link below talking about a similar problem that should help you to solve the problem.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-networking/the-network-folder-specified-is-currently-mapped/928f6313-fe2c-4d2D-A247-152ec022e062

  • Can I use java for the development of the playbook?

    Hi I'm new in blackberry development. I've owned playbook and that you want to develop playbook apps, but I can only develop in java. Please, someone tell me what I can use java for the development of the Tablet?

    Bilal

    # You can convert by android android applications, run-time.

    Explore these links

    https://developer.BlackBerry.com/

    https://developer.BlackBerry.com/Java/

  • Using java script with QML, save a text in a variable of java script and showing in a label

    I'm trying to find a way to take a text entered by the user into a text field and display it in a label using java script. The trickiest part is I want to be seen in the label after restarting the application.
    Any idea?
    Should I use a JS file with functions. If so, what are best practices?

    Thanks in advance!

    This example uses a little bit of C++, I'm not sure if this can be done with purely JS

    in your text box or label apply onTextChanged you probably want to have a Setup button to activate & deactivate the area of text, or if they delete it, the text of the label would be erased

    . QML

    TextArea {
        id: myTextArea
        onTextChanged: {
            myTextArea.text = myLabel.text;
            //you could also apply ^ to a button's onClicked function etc
            App.saveValueFor("mySavedText" myTextArea.text);
        }
    }
    Label {
        id: myLabel
        text: App.getValueFor("mySavedText", "");
    }
    

    App.saveValueFor (); QSettings uses will have to be reset in your ApplicationUI.cpp & .h

    .cpp

    App is obtained by setting a context property

    qml->setContextProperty("App", this);
    
    QString App::getValueFor(const QString &objectName, const QString &defaultValue)
    {
        QSettings settings;
    
        // If no value has been saved, return the default value.
        if (settings.value(objectName).isNull()) {
            return defaultValue;
        }
    
        // Otherwise, return the value stored in the settings object.
        return settings.value(objectName).toString();
    }
    
    void App::saveValueFor(const QString &objectName, const QString &inputValue)
    {
        // A new value is saved to the application settings object.
        QSettings settings;
        settings.setValue(objectName, QVariant(inputValue));
    
    }
    

    all

    public:
    
        Q_INVOKABLE
        QString getValueFor(const QString &objectName, const QString &defaultValue);
    
        Q_INVOKABLE
        void saveValueFor(const QString &objectName, const QString &inputValue);
    

    You'll also need to slect the permission of files shared in the descriptor for QSettings bar to work

  • Send a Blackberry smart phone info to a database on a server using Java?

    Hello

    I'm new to the Blackberry development... but I now have a project to do.

    I want to retrieve the latitude and longitude of Blackberry GPS and send them to a database on a server every 30 minutes.  Also, I want to be able to do without the user doing anything on his Blackberry (I mean, I don't want him to click somewhere every now and them).

    I was able to get the latitude and longitude (double) using Java.

    I don't know how to get out them of the BlackBerry.

    Can anyone help?

    Thank you

    BTW, I do my testing on a 8310 Rogers using JDE 4.2.1 Simulator.

    Hello

    The BlackBerry smart phone needs a 'gateway' to connect to the internet. This white paper is extremely useful to explain all your choices of selection of the good gateway:

    Data on BlackBerry 4 Wireless Transport Management - Part 1

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe?func=LL&objid=832210&objAction=browse&s...

    Once you have selected the gateway, then you can go ahead and use the Connector.open (url) command to create a HTTP connection to the application server (Tomcat, JBoss, .NET, etc.) on the internet. The application server could then use ODBC/JDBC to store data in the database.

    Tariq

Maybe you are looking for