users@glassfish.java.net

Re: UpdateCenter from console with GFv2.1.1

From: Snjezana Sevo-Zenzerovic <Snjezana.Sevo-Zenzerovic_at_Sun.COM>
Date: Mon, 11 Jan 2010 15:00:48 -0800

This is highly irregular, but should get you going :-)

You can get the same Hibernate module file as the one used in v 2.1.1
update center from this URL:

http://javaee-updates.java.sun.com/beta/modules/hibernate/3_4_0/glassfish-hibernate-3_4_0.nbm

Once you download, unzip the .nbm file and you'll find
module/glassfish-hibernate-1_0.zip inside. That zip file should be
extracted into top level glassfish directory and it will place Hibernate
jar files into lib subdirectory. These are further instructions on
Hibernate setup that come with this update center module - excuse the
shoddy formatting :-)

Hibernate JPA
 
Version:
3.4.0
 Overview
The goal is to have hibernate as a JPA provider available to a GlassFish
Application Server instance. After this module is successfully installed
you can use Hibernate as a persistence provider for your JPA applications

 Post Installation
 
Module Install Directory: Getting Started:
<GlassFish Root>/lib Please refer to instructions below to start using
Hibernate as persistence provider
  When you install this module, following jars will be copied to your
<GlassFish_Root>/lib directory. These jars correspond to
hibernate-entitymanager-3.4.0.GA and hibernate-distribution-3.3.1.GA
antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
hibernate3.jar
javassist-3.4.GA.jar
slf4j-api-1.5.3.jar
slf4j-jdk14-1.5.3.jar

Here are some FAQs
What do I need to do to start using Hibernate as your JPA provider?

By default GlassFish uses Toplink Essentials as the persistence provider
for JPA. Please modify persistence.xml of your JPA application to use
"org.hibernate.ejb.HibernatePersistence" as the provider. Here is how a
sample persistence.xml will look.
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name ="..." transaction-type = "...">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        ...
        ...
    </persistence-unit>
</persistence>

How do I turn on SQL logging for hibernate ? You need to add property
"hibernate.show_sql" with value "true" in your persistence.xml Here is
how a sample persistence.xml will look.
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name ="..." transaction-type = "...">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        ...
        ...
        <properties>
          <property name="hibernate.show_sql" value="true"/>
        </properties>
        ...
        ...
    </persistence-unit>
</persistence>

How do I turn on schema generation when using hibernate as JPA provider?
You need to add property "hibernate.hbm2ddl.auto" with value "true" in
your persistence.xml Here is how a sample persistence.xml will look:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name ="..." transaction-type = "...">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        ...
        ...
        <properties>
          <property name="hibernate.hbm2ddl.auto" value="true"/>
        </properties>
        ...
        ...
    </persistence-unit>
</persistence>

How do I control logging level for hibernate? Hibernate uses slf4j for
logging. This update ships with the JDK logging adaptor for slf4j. Which
will use JDK loggers for Hibernate. The log output of hibernate is
available in server.log for current domain. You can configure log level
of hibernate using same mechanism as any other jdk logger - which is to
add property "org.hibernate" with desired log level to application
server's logging configuration. To change log level using GUI, go to
appserver's admin console. Go to Application Server / Logging tab. Go to
Log Levels sub tab. Go to bottom of the page and select Add Property
button. Add Name of the hibernate logger (say org.hibernate) value as
desired log level say (FINEST). Please refer to Hibernate documentation
for various loggers available. Please refer to documentation of slf4j if
you want to configure hibernate to use commons logging or other logging
framework.





Major Péter wrote:
> Could someone help me with this?
> I only would like to add hibernate to my external installation. Is it
> enough, if I just copy the hibernate jar files from my local glassfish?
> Thanks.
>
> Peter
>
> 2009-12-18 03:17 keltezéssel, Major Péter írta:
>
>> Hi,
>>
>> I'm trying to run updatecenter on a server, but so far didn't had
>> success. The problem is, that the updatetool is only available with GUI,
>> and the server doesn't has any graphical interface or whatsoever. (so
>> SSH X forward was unsuccessful) I tried also with sshfs mounting the
>> server to localhost, but apperently my laptop has x64 jvm, and the
>> server is x86, so this didn't worked too. (I don't want to install a x86
>> jvm just for this :) )
>> I also tried with NetBeans Remote Server and running from there, but
>> this updated my local server instead..
>>
>> So, how could I run updatecenter and install hibernate (maybe later
>> update) from command line interface?
>> Thanks
>>
>> Regards,
>> Peter
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>