-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Named query checking : enabled
PostPosted: Wed Jan 23, 2008 12:47 pm 
Newbie

Joined: Mon Nov 05, 2007 2:02 pm
Posts: 8
I used Reverse Engineering of Hibernate Tools with Ant task.
I have problem with hbm2java when I run, it's very long.
My database have 137 tables. Log in console stop on
"INFO: Named query checking : enabled" and it take more than 1 minute to continu.

If it's to check named query very long, can I disabled it and how ?

thanks Laurent

AntTask


Code:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />

      <hibernatetool destdir="${src.dir}">
        <jdbcconfiguration propertyfile="./conf/hibernate.properties" revengfile="./conf/hibernate.reveng.xml" reversestrategy="com.apo.hibernate.tool.CustomRevengStrategy" packagename="com.apo.server.core.persistance" detectmanytomany="false"/>
        <hbm2java jdk5="true" ejb3="true"/>
      </hibernatetool>


hibernate.properties
Code:
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.url=jdbc:postgresql://192.168.1.42:5432/lab4_dev
hibernate.connection.username=postgres
hibernate.connection.password=postgres
hibernate.connection.pool_size=10
#hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.format_sql=true
hibernate.default_schema=public


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 28, 2008 5:09 am 
Newbie

Joined: Mon Nov 05, 2007 2:02 pm
Posts: 8
Anyone have idea ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 28, 2008 2:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that checking should only occur if you are creating a sessionfactory with a alot of named queries.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 29, 2008 4:11 am 
Newbie

Joined: Mon Nov 05, 2007 2:02 pm
Posts: 8
I think I use default parameters of Ant task (you can view my hibernate.properties) and yes I've got approximately 120 named query.

How can I do?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 29, 2008 4:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
but the ant task does not create a sessionfactory to generate code thus I do not understand why you have the issue in the first place while using our ant task.

Are you sure this is not for when running in your app ? Then it is just a flag you need to set. I dont have the source readily available here but look at the Environment.java class and look for a named query check parameter.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 30, 2008 6:39 am 
Newbie

Joined: Mon Nov 05, 2007 2:02 pm
Posts: 8
I use Netbeans to compile project.

Netbeans use Ant to run build.xml

Here my build.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="lab_server_persistance" default="default" basedir=".">
    <description>Builds, tests, and runs the project lab4_server_persistance.</description>
    <import file="nbproject/build-impl.xml"/>
   
    <path id="compillib">
      <path location="../../lib/hibernatetools/hibernate-tools.jar"/>
      <path location="../../lib/hibernatetools/hibernate-3.2/hibernate3.jar" />
    </path>

    <path id="toolslib">
      <path location="../../lib/hibernatetools/hibernate-tools.jar"/>
      <path location="../../lib/hibernatetools/freemarker.jar" />
      <path location="../../lib/hibernatetools/hibernate-3.2/cglib-2.1.3.jar" />
      <path location="../../lib/hibernatetools/hibernate-3.2/asm.jar" />
      <path location="../../lib/hibernatetools/hibernate-3.2/hibernate3.jar" />
      <path location="../../lib/hibernatetools/hibernate-3.2/commons-logging-1.0.4.jar" />
      <path location="../../lib/hibernatetools/hibernate-3.2/commons-collections-2.1.1.jar"/>
      <path location="../../lib/hibernatetools/hibernate-3.2/dom4j-1.6.1.jar" />
      <path location="../../lib/postgresql-8.2-505.jdbc3.jar" />
      <path location="./build/classes/" />
    </path>
       
    <target name="-pre-compile">
      <delete>
        <fileset dir="${src.dir}/com/apo/server/core/persistance" includes="*.java"/>
        <fileset dir="${src.dir}/com/apo/server/core/persistance/bean" includes="*.java"/>
      </delete>
      <javac srcdir="${src.dir}" destdir="${build.classes.dir}" classpathref="compillib"/>
   
       
        <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />

      <hibernatetool destdir="${src.dir}">
        <jdbcconfiguration propertyfile="./conf/hibernate.properties" revengfile="./conf/hibernate.reveng.xml" reversestrategy="com.apo.hibernate.tool.CustomRevengStrategy" packagename="com.apo.server.core.persistance" detectmanytomany="false"/>
        <hbm2java jdk5="true" ejb3="true"/>
      </hibernatetool>
    </target>
</project>


here compile logs:
Code:
init:
deps-clean:
Deleting directory C:\www\lab\server\persistance\build
Deleting directory C:\www\lab\server\persistance\dist
clean:
init:
deps-jar:
Created dir: C:\www\lab\server\persistance\build\classes
Compiling 6 source files to C:\www\lab\server\persistance\build\classes
Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
1. task: hbm2java (Generates a set of .java files)
30 janv. 2008 11:35:53 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.4.sp1
30 janv. 2008 11:35:53 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
30 janv. 2008 11:35:53 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
30 janv. 2008 11:35:53 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
30 janv. 2008 11:35:53 org.hibernate.cfg.reveng.OverrideRepository addFile
INFO: Override file: C:\www\lab\server\persistance\conf\hibernate.reveng.xml
30 janv. 2008 11:35:54 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
30 janv. 2008 11:35:54 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 10
30 janv. 2008 11:35:54 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
30 janv. 2008 11:35:54 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.postgresql.Driver at URL: jdbc:postgresql://192.168.1.42:5432/lab_dev
30 janv. 2008 11:35:54 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=postgres, password=****}
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: PostgreSQL, version: 8.1.9
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.2 JDBC3 with SSL (build 505)
30 janv. 2008 11:35:55 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
30 janv. 2008 11:35:55 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
30 janv. 2008 11:35:55 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default schema: public
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
30 janv. 2008 11:35:55 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
30 janv. 2008 11:35:55 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
30 janv. 2008 11:36:28 org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:postgresql://192.168.1.42:5432/lab4_dev
30 janv. 2008 11:36:28 org.hibernate.tool.Version <clinit>
INFO: Hibernate Tools 3.2.0.b9
Compiling 157 source files to C:\www\lab\server\persistance\build\classes
Copying 2 files to C:\www\lab\server\persistance\build\classes
Copied 2 empty directories to 1 empty directory under C:\www\lab\server\persistance\build\classes
compile:
Created dir: C:\www\lab\server\persistance\dist
Building jar: C:\www\lab\server\persistance\dist\lab_server_persistance.jar
jar:
BUILD SUCCESSFUL (total time: 39 seconds)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 4:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so this is just the logging of the fact that this setting is enabled.

Your log says the total time is 39 seconds and reading the timestamps says the reverse engineering process (get connection, read metadata, generate the code, close connection) takes about 33 seconds.

Not sure where that 1 minute you mention is coming from ?

If the time varies greatly I would suspect it to be the actual connection taking time to be established.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 4:35 am 
Newbie

Joined: Mon Nov 05, 2007 2:02 pm
Posts: 8
My question is not
how exactly time take checked named query ?
But
How can i disabled checked named query when I compile project?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 8:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that line has nothing to do with the thing taking a long time.

don't regenerate all the classes everytime you compile if you dont want to wait for the generation every time.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.