-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate NetBeans has a problem
PostPosted: Wed Feb 23, 2011 3:31 pm 
Newbie

Joined: Wed Feb 23, 2011 3:23 pm
Posts: 1
Problem
Code:
23/02/2011 16:13:58 org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.1.GA
23/02/2011 16:13:58 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
23/02/2011 16:13:58 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
23/02/2011 16:13:58 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
23/02/2011 16:13:58 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
23/02/2011 16:13:58 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
23/02/2011 16:13:58 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
23/02/2011 16:13:58 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Entidades/Login.hbm.xml
23/02/2011 16:13:58 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Entidades/Tipo.hbm.xml
23/02/2011 16:13:59 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Entidades/Funcionario.hbm.xml
23/02/2011 16:13:59 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : Entidades/Livros.hbm.xml
23/02/2011 16:13:59 org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
23/02/2011 16:13:59 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Entidades.Login -> login
23/02/2011 16:13:59 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Entidades.Tipo -> tipo
23/02/2011 16:13:59 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Entidades.Funcionario -> funcionario
23/02/2011 16:13:59 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: Entidades.Livros -> livros
23/02/2011 16:13:59 org.hibernate.cfg.AnnotationConfiguration secondPassCompile
INFO: Hibernate Validator not found: ignoring
23/02/2011 16:13:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
23/02/2011 16:13:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
23/02/2011 16:13:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
23/02/2011 16:13:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/controle_livros
23/02/2011 16:13:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****}
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 5.1.53-community
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
23/02/2011 16:13:59 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
23/02/2011 16:13:59 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
23/02/2011 16:13:59 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
23/02/2011 16:13:59 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
23/02/2011 16:14:00 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
23/02/2011 16:14:00 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
23/02/2011 16:14:00 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
23/02/2011 16:14:00 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
org.hibernate.HibernateException: No CurrentSessionContext configured!


Config Hibernate


Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/controle_livros</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">adm</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
    <property name="hibernate.show_sql">true</property>
    <property name="format_sql">true</property>
    <mapping resource="Entidades/Login.hbm.xml"/>
    <mapping resource="Entidades/Tipo.hbm.xml"/>
    <mapping resource="Entidades/Funcionario.hbm.xml"/>
    <mapping resource="Entidades/Livros.hbm.xml"/>
  </session-factory>
</hibernate-configuration>


Database Layer

Code:
    public boolean dbLogin(String strLogin, String strSenha) {

        try {
            Session sessao = utilLogin.getSessionFactory().getCurrentSession();
            Transaction tx = sessao.beginTransaction();
            Query select = sessao.createQuery("from Login where Login = :login");
            select.setString("login","vinny");
            lstLista = select.list();
            tx.commit();
            sessao.close();
            if (lstLista.isEmpty()) {
                return false;
            }
            return true;
        } catch (HibernateException hibernateException) {
            System.out.println(hibernateException);
            return false;
        }
    }


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

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.