dev@glassfish.java.net

Re: PU with TX Type JTA

From: Lance J. Andersen <Lance.Andersen_at_Sun.COM>
Date: Tue, 19 Jun 2007 16:46:10 -0400

Hi Arun,

Here is a simple Hello World web Application using

JSPs/JSTL/simple Java Bean, JPA (Resource-Local Tx).

You will need to tweak the persistence.xml and the run property for the
project to point to your glassfish

To run
http://<host>:<port>/JPAWeb/


I will probably clean this up a bit more and push it as a blog later
this week.


FWIW, i did find it a bit painful to tweak the persisitence.xml in NB
5.5as i could not do anything but use a datasource because i was
configured to deploy to Glassfish. It should allow me to choose whether
I am using jta/datasource or a local resource without editing it by hand
(in the xml view).

Also, you might have to stop and restart your domain if you
deploy/undeploy as the build of v2 i had seemed to be a bit touchy to
constant redeployments.

Let me know if this is what you were looking for.

-lance

Arun Gupta wrote:
>> http://weblogs.java.net/blog/ss141213/archive/2005/12/introduction_to.html
>> as this is a simple servlet that Sahoo created.
> persistence.xml in the blog is:
>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> version="1.0">
> <persistence-unit name ="em1"/>
> </persistence>
>
> This is very different from the one generated by default now. Does it
> seem right ?
>
>>>> http://weblogs.java.net/blog/lancea/archive/2007/06/using_java_web.html
>>>>
>>> This is a recent entry and has way too much details for HW.
>> could u please explain what HW is? Is it Home Work?
> Hello World :)
>
>>>
>>> Bullet#5 says "default data source jdbc/sample". This is not valid
>>> for GlassFish V2 b50/NB 5.5.1. My code is now:
>> This is the old sample default DataSource config in Glassfish.
>> jdbc/__default is what ships now.
> Hmm, I don't see any in my NetBeans :(
>
>>> oracle.toplink.essentials.exceptions.DatabaseException
>>> Internal Exception: java.sql.SQLException: Table/View 'COMPANY' does
>>> not exist.
>> I would enable logging via
>> <property name="toplink.logging.level" value="FINE"/>
> Where/How do I specify this entry ?
>
>>
>> to see what is happening at deploy time as it looks like your table
>> is not being created.
> Yes, I can see that from the error message. But what's weird is that
> I'm seeing this message during em.query and not during em.persist.
>
> -Arun
>
>>
>>
>>> Error Code: -1
>>> Call: SELECT ID, CHANGE, PERCENTCHANGE, PRICE, LASTUPDATED,
>>> COMPANYNAME FROM COMPANY WHERE (ID = CAST (? AS VARCHAR(32672) ))
>>> bind => [1]
>>> Query: ReportQuery(sample.Company)
>>> at
>
>