Well, thanks for your replies!

I'll try to define a separate persistence.xml as suggested and specify the connection by hand.

Many thanks!

Horacio

On Thu, Dec 4, 2008 at 7:10 AM, Robert Manning <robert.m.manning@gmail.com> wrote:
Thanks for clarifying that for us Gerd!

Rob

On Wed, Dec 3, 2008 at 9:43 PM, Gerd Wagner <gerdhwagner@t-online.de> wrote:
> Rob,
>
> you are absolutely right about the in-container usage. But the Plugin offers
> support for JPA, see the second radio button on the configuration tab.
>
> JPA, as shown in your example, is designed in a way that it can be used
> independent from a container. Nonetheless it might be mostly used inside a
> container. The Plugin offers no direct support for in-container JPA
> configurations.
>
>
>
> The Hibernate Plugin doesn't make any use of the Hibernate jars we ship with
> SQuirreL. The user has to add all Hibernate libraries he is using in his
> application to the classpath that has to be defined in the Hibernate Plugin
> configuration. The Plugin uses a special Classloader. This Classloader knows
> only the standard JRE libs and the user defined classpath.
>
>
> Gerd
>
>
> Robert Manning wrote:
>>
>> Horatio,
>>
>> Your persistence unit configuration (persistence.xml) has more of
>> an in-container (JBOSS) configuration, than J2SE.  You may find that you
>> need to have a separate persistence.xml for testing and running in
>> SQuirreL, then what you normally deploy with your application.
>> Specifically, you
>> seem to be configuring hibernate to lookup your datasource in JNDI.  Also,
>> you are configured to use JTA instead of RESOURCE_LOCAL.  Do you have
>> a JNDI provider that you are using to define a JNDI context, in which you
>> register your dataSource ?  Also, do you need to support distributed
>> transactions while you are using the Hibernate plugin in SQuirreL ?
>> Perhaps a simpler J2SE-style configuration would be more appropriate
>> in this case.  In Hibernate documentation I found this page:
>>
>>
>> http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/configuration.html
>>
>> It presents the following "typical" J2SE configuration for
>> persistence.xml near the
>> bottom of the page :
>>
>> <persistence>
>>   <persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL">
>>      <class>org.hibernate.ejb.test.Cat</class>
>>      <class>org.hibernate.ejb.test.Distributor</class>
>>      <class>org.hibernate.ejb.test.Item</class>
>>      <properties>
>>         <property name="hibernate.dialect"
>> value="org.hibernate.dialect.HSQLDialect"/>
>>         <property name="hibernate.connection.driver_class"
>> value="org.hsqldb.jdbcDriver"/>
>>         <property name="hibernate.connection.username" value="sa"/>
>>         <property name="hibernate.connection.password" value=""/>
>>         <property name="hibernate.connection.url" value="jdbc:hsqldb:."/>
>>         <property name="hibernate.max_fetch_depth" value="3"/>
>>
>>         <!-- cache configuration -->
>>         <property
>> name="hibernate.ejb.classcache.org.hibernate.ejb.test.Item"
>> value="read-write"/>
>>         <property
>>
>> name="hibernate.ejb.collectioncache.org.hibernate.ejb.test.Item.distributors"
>> value="read-write, RegionName"/>
>>
>>         <!-- alternatively to <class> and <property> declarations,
>> you can use a regular hibernate.cfg.xml file -->
>>         <!-- property name="hibernate.ejb.cfgfile"
>> value="/org/hibernate/ejb/test/hibernate.cfg.xml"/ -->
>>      </properties>
>>   </persistence-unit>
>> </persistence>
>>
>> Notice that instead of using "JTA" for the transaction-type it's
>> RESOURCE_LOCAL.
>> Also, instead of looking up the datasource in JNDI, it simply
>> configures connection
>> properties.
>>
>> One other thing here - I believe the plugin was developed and tested
>> for non-JPA use (that is, with hibernate configuration files instead
>> of annotations).  We ship the hibernate entitymanager and annotations
>> jars with SQuirreL, although I don't think we use them at the moment.
>> That's not to say that JPA cannot be used, just that development of
>> the Hibernate plugin for SQuirreL wasn't focused on that use case - I
>> believe.
>>
>> Rob
>>
>>
>>
>>
>>
>> On Tue, Dec 2, 2008 at 8:42 PM, Horacio Vico <horacio.vico@gmail.com>
>> wrote:
>>>
>>> Hi people, today I discovered this wonderful SQL Client, great job
>>> developers!
>>>
>>> I am trying to configure the hibernate plugin, and after I got rid of
>>> some ClassNotFoundException by adding the proper jars to the
>>> "additional classpath" list, I have the following error:
>>>
>>> java.lang.reflect.InvocationTargetException
>>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>       at
>>> sun
>>> .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>> 39)
>>>       at
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
>>> 25)
>>>       at java.lang.reflect.Method.invoke(Method.java:585)
>>>       at
>>> net
>>> .sourceforge
>>> .squirrel_sql
>>> .plugins
>>> .hibernate.HibnerateConnector.doConnect(HibnerateConnector.java:70)
>>>       at
>>> net
>>> .sourceforge.squirrel_sql.plugins.hibernate.HibnerateConnector.access
>>> $000(HibnerateConnector.java:12)
>>>       at
>>> net.sourceforge.squirrel_sql.plugins.hibernate.HibnerateConnector
>>> $1.run(HibnerateConnector.java:27)
>>>       at java.lang.Thread.run(Thread.java:613)
>>>       at
>>> net.sourceforge.squirrel_sql.plugins.hibernate.HibnerateConnector
>>> $2.run(HibnerateConnector.java:40)
>>>       at
>>> java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
>>>       at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
>>>       at net.sourceforge.squirrel_sql.client.Application
>>> $1.dispatchEvent(Application.java:191)
>>>       at
>>> java
>>> .awt
>>> .EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:
>>> 269)
>>>       at
>>> java
>>> .awt
>>> .EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
>>> 190)
>>>       at
>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
>>> 184)
>>>       at
>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
>>> 176)
>>>       at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
>>> Caused by: javax.persistence.PersistenceException: No Persistence
>>> provider for EntityManager named SeamJGenUITestApp
>>>       at
>>> javax
>>> .persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
>>>       at
>>> javax
>>> .persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
>>>       ... 17 more
>>>
>>>
>>> I configured the plugin to use
>>> javax.persistence.Persistence.createEntityManagerFactory with entity
>>> name SeamJGenUITestApp
>>> This is my persistence.xml file (I've also added the folder that
>>> contains this file in the "additional classpath" config.
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <!-- Persistence deployment descriptor for dev profile -->
>>> <persistence 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"
>>>             version="1.0">
>>>
>>>   <persistence-unit name="SeamJGenUITestApp" transaction-type="JTA">
>>>      <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>      <jta-data-source>java:/SeamJGenUITestAppDatasource</jta-data-
>>> source>
>>>      <properties>
>>>         <property name="hibernate.dialect"
>>> value="org.hibernate.dialect.MySQLDialect"/>
>>>         <property name="hibernate.hbm2ddl.auto" value="update"/>
>>>         <property name="hibernate.show_sql" value="false"/>
>>>         <property name="hibernate.format_sql" value="true"/>
>>>         <property name="hibernate.transaction.manager_lookup_class"
>>> value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
>>>      </properties>
>>>   </persistence-unit>
>>>
>>> </persistence>
>>>
>>> Any suggestion?
>>>
>>> Many thanks in advance!
>>>
>>> Horacio
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Squirrel-sql-users mailing list
>>> Squirrel-sql-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
>>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Squirrel-sql-users mailing list
>> Squirrel-sql-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
>>
>
>