Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to create EclipseLink Sessions, ORM.xml files in J2SE environment

You don't have to worry about using Sessions, all of that happens
beind the scenes. The same with UnitOfWork, now you can obtain these
things and use them from an EntityManager by casting the EntityManager
to the EclipseLink EntityManagerImpl, I do that to take advantage of
the hasChanges method like this:

  public boolean isDirty() {

    UnitOfWork uow = ((EntityManagerImpl)
model.getEntityManager).getUnitOfWork();
        return uow.hasChanges();
    }


./tch



On Sun, Jan 18, 2009 at 1:20 AM, krisusa123 <krisusa123@xxxxxxxxx> wrote:
> Hi Tim
> Thanks for taking the time for replying to my query. I still did not get
> from the links you pointed me out of how to create sessions. I see you are
> using entitymanagerfactory and entitymanager. I dont see creatin any
> sessions and unit of works in these examples.
>
> Can you help me with that?
>
> Thanks
> Kris
>
> f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng
>
> --- On Sat, 1/17/09, Tim Hollosy <hollosyt@xxxxxxxxx> wrote:
>
> From: Tim Hollosy <hollosyt@xxxxxxxxx>
> Subject: Re: [eclipselink-users] How to create EclipseLink Sessions, ORM.xml
> files in J2SE environment
> To: "EclipseLink User Discussions" <eclipselink-users@xxxxxxxxxxx>
> Date: Saturday, January 17, 2009, 6:54 PM
>
> Don't do it all alone!
>
> Look here:
> http://www.weheartcode.com/2008/08/27/eclipselink-in-j2se-rcp-applications/
>
> and
>
> http://wiki.eclipse.org/EclipseLink/Examples/OSGi
>
> ./tch
>
>
>
> On Sat, Jan 17, 2009 at 5:59 PM, krisUSA123 <krisusa123@xxxxxxxxx> wrote:
>>
>> Hello
>> I am a newbie to EclipseLink and so far was able to write an
> persistence.xml
>> file where I can do CRUD operations against my DB.
>>
>> How do I create a Session in a pure J2SE environment so that I can use
> "Unit
>> Of Work" concepts working. Do I need a Database Session created or
> just a
>> regular ServerSession. Also, any links, examples that you can throw at me
>> would be very helpful.
>>
>> Any examples of ORM.xml files is also very helpful.
>>
>> Here is what my persistence file looks like:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <persistence version="1.0"
> 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";>
>>        <persistence-unit name="Prototype"
> transaction-type="RESOURCE_LOCAL">
>>                <provider>
>>           org.eclipse.persistence.jpa.PersistenceProvider
>>        </provider>
>>                <class>TestEtl</class>
>>                <properties>
>>                        <!--  Logging defaults set here -->
>>                        <property
> name="eclipselink.logging.level" value="FINE"/>
>>                        <property
> name="eclipselink.logging.thread" value="false"/>
>>                        <property
> name="eclipselink.logging.timestamp" value="false"/>
>>                        <property
> name="eclipselink.logging.exceptions" value="false"/>
>>
>>                        <!-- Oracle Connections -->
>>
>>                <property name="eclipselink.jdbc.driver"
>> value="oracle.jdbc.driver.OracleDriver" /><property
>> name="eclipselink.logging.session" value="false"/>
>>                <property name="eclipselink.jdbc.url"
>> value="jdbc:oracle:thin:@//xx"/>
>>                <property name="eclipselink.jdbc.password"
> value="xx"/>
>>                <property name="eclipselink.jdbc.user"
> value="xx"/>
>>                <property
> name="eclipselink.jdbc.read-connections.min"
>> value="1"/>
>>                        <property
> name="eclipselink.jdbc.write-connections.min" value="1"/>
>>                        <property
> name="eclipselink.target-database" value="Oracle"/>
>>                        <property
> name="eclipselink.jdbc.batch-writing" value="JDBC" />
>>        </properties>
>>        </persistence-unit>
>> </persistence>
>>
>> As Always,
>> Thanks in Advance!
>>
>> Kris
>>
>>
>> --
>> View this message in context:
> http://www.nabble.com/How-to-create-EclipseLink-Sessions%2C-ORM.xml-files-in-J2SE-environment-tp21490017p21490017.html
>> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>


Back to the top