JoatanGuj 8 de set. de 2011
Query query = this . entityManager . createQuery ( "select * from usuario;" );
não seria esse “;” que ta te atrapalhando Query?
tenta assim:
Query query = this . entityManager . createQuery ( "select * from usuario" );
jv.nicocelli 8 de set. de 2011
Tentei das duas formas, porém acontece o mesmo erro.
lucasportela 8 de set. de 2011
EntityManager tem instância?
jv.nicocelli 8 de set. de 2011
Bom, creio que sim, estou seguindo um exemplo da apostila da k19 Desenvolvimento web com jsf e jpa.
fredericomaia10 8 de set. de 2011
O correto no UsuarioBean seria
@ManagedProperty ( value = "#{entityManager}" )
E seguindo a apostila você criou os filtros que ela pede? Interceptando o Faces Servlet, aonde é criada a instância do EntityManager?
jv.nicocelli 8 de set. de 2011
fredericomaia10,
Criei o filtro conforme está na apostila.
Realizei a alteração para:
public class UsuarioBean {
@ManagedProperty ( value = "#{entityManager}" )
mais ainda esta ocorrendo o erro:
AVISO : JSF1063 : AVISO ! Definindo valor de atributo não serializável em HttpSession ( chave : usuarioBean , classe do valor : br . com . bean . UsuarioBean ).
08 / 09 / 2011 14 : 34 : 09 com . sun . faces . application . view . FaceletViewHandlingStrategy handleRenderException
GRAVE : Error Rendering View [ / listaUsuarios . xhtml ]
javax . el . ELException : / listaUsuarios . xhtml @11 , 75 value = "#{usuarioBean.usuarios}" : Error reading ‘ usuarios ’ on type br . com . bean . UsuarioBean
at com . sun . faces . facelets . el . TagValueExpression . getValue ( TagValueExpression . java : 111 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 190 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 178 )
at javax . faces . component . UIData . getValue ( UIData . java : 554 )
at javax . faces . component . UIData . getDataModel ( UIData . java : 1278 )
at javax . faces . component . UIData . setRowIndex ( UIData . java : 447 )
at com . sun . faces . renderkit . html_basic . TableRenderer . encodeBegin ( TableRenderer . java : 77 )
at javax . faces . component . UIComponentBase . encodeBegin ( UIComponentBase . java : 824 )
at javax . faces . component . UIData . encodeBegin ( UIData . java : 937 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1641 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1646 )
at com . sun . faces . application . view . FaceletViewHandlingStrategy . renderView ( FaceletViewHandlingStrategy . java : 389 )
at com . sun . faces . application . view . MultiViewHandler . renderView ( MultiViewHandler . java : 127 )
at javax . faces . application . ViewHandlerWrapper . renderView ( ViewHandlerWrapper . java : 269 )
at com . sun . faces . lifecycle . RenderResponsePhase . execute ( RenderResponsePhase . java : 117 )
at com . sun . faces . lifecycle . Phase . doPhase ( Phase . java : 97 )
at com . sun . faces . lifecycle . LifecycleImpl . render ( LifecycleImpl . java : 135 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 309 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 304 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 240 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 164 )
at org . apache . catalina . authenticator . AuthenticatorBase . invoke ( AuthenticatorBase . java : 462 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 164 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 100 )
at org . apache . catalina . valves . AccessLogValve . invoke ( AccessLogValve . java : 562 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 118 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 395 )
at org . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 250 )
at org . apache . coyote . http11 . Http11Protocol$Http11ConnectionHandler . process ( Http11Protocol . java : 188 )
at org . apache . tomcat . util . net . JIoEndpoint$SocketProcessor . run ( JIoEndpoint . java : 302 )
at java . util . concurrent . ThreadPoolExecutor$Worker . runTask ( Unknown Source )
at java . util . concurrent . ThreadPoolExecutor$Worker . run ( Unknown Source )
at java . lang . Thread . run ( Unknown Source )
Caused by : java . lang . NullPointerException
at br . com . repositorio . UsuarioRep . getUsuarios ( UsuarioRep . java : 23 )
at br . com . bean . UsuarioBean . getUsuarios ( UsuarioBean . java : 23 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at javax . el . BeanELResolver . getValue ( BeanELResolver . java : 87 )
at javax . el . CompositeELResolver . getValue ( CompositeELResolver . java : 67 )
at com . sun . faces . el . FacesCompositeELResolver . getValue ( FacesCompositeELResolver . java : 71 )
at org . apache . el . parser . AstValue . getValue ( AstValue . java : 169 )
at org . apache . el . ValueExpressionImpl . getValue ( ValueExpressionImpl . java : 189 )
at com . sun . faces . facelets . el . TagValueExpression . getValue ( TagValueExpression . java : 106 )
… 33 more
CHAMANDO O REPOSITÓRIO !!
CHAMANDO O REPOSITÓRIO !!
fredericomaia10 8 de set. de 2011
Outro detalhe, sua classe UsuarioBean precisa estar anotada como ManagedBean, importando-a do javax.faces…
@ManagedBean
public class UsuarioBean {
@ManagedProperty(value = "#{entityManager}")
Michel_M 8 de set. de 2011
Vc esta trabalhando com Objeto relacional?..então a sua query vai ficar assim:
Query query = this . entityManager . createQuery ( "select u from Usuario u" ); //Usuario representa a sua Classe Usuario que é o seu POJO
jv.nicocelli 8 de set. de 2011
Adicionei a anotação @ManagedBean na classe usuário e também modifiquei a query, mais o erro continua.
Query query = this . entityManager . createQuery ( "select u from Usuario u" );
Os erro aponta para essa linha.
Query q = this . entityManager . createQuery ( "select u FROM Usuario u" );
Sera que há algo de errado no método abaixo?
public List < Usuario > getUsuarios () {
Query q = this .entityManager .createQuery ( "select u FROM Usuario u" ) ;
return q .getResultList () ;
}
fredericomaia10 8 de set. de 2011
O erro continua o mesmo?
NullPointerException ?
jv.nicocelli 8 de set. de 2011
Segue o erro…
08 / 09 / 2011 15 : 54 : 24 com . sun . faces . context . SessionMap put
AVISO : JSF1063 : AVISO ! Definindo valor de atributo não serializável em HttpSession ( chave : usuarioBean , classe do valor : br . com . bean . UsuarioBean ).
CHAMANDO O REPOSITÓRIO !!
08 / 09 / 2011 15 : 54 : 24 com . sun . faces . application . view . FaceletViewHandlingStrategy handleRenderException
GRAVE : Error Rendering View [ / listaUsuarios . xhtml ]
javax . el . ELException : / listaUsuarios . xhtml @11 , 75 value = "#{usuarioBean.usuarios}" : Error reading ' usuarios ' on type br . com . bean . UsuarioBean
at com . sun . faces . facelets . el . TagValueExpression . getValue ( TagValueExpression . java : 111 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 190 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 178 )
at javax . faces . component . UIData . getValue ( UIData . java : 554 )
at javax . faces . component . UIData . getDataModel ( UIData . java : 1278 )
at javax . faces . component . UIData . setRowIndex ( UIData . java : 447 )
at com . sun . faces . renderkit . html_basic . TableRenderer . encodeBegin ( TableRenderer . java : 77 )
at javax . faces . component . UIComponentBase . encodeBegin ( UIComponentBase . java : 824 )
at javax . faces . component . UIData . encodeBegin ( UIData . java : 937 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1641 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1646 )
at com . sun . faces . application . view . FaceletViewHandlingStrategy . renderView ( FaceletViewHandlingStrategy . java : 389 )
at com . sun . faces . application . view . MultiViewHandler . renderView ( MultiViewHandler . java : 127 )
at javax . faces . application . ViewHandlerWrapper . renderView ( ViewHandlerWrapper . java : 269 )
at com . sun . faces . lifecycle . RenderResponsePhase . execute ( RenderResponsePhase . java : 117 )
at com . sun . faces . lifecycle . Phase . doPhase ( Phase . java : 97 )
at com . sun . faces . lifecycle . LifecycleImpl . render ( LifecycleImpl . java : 135 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 309 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 304 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 240 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 164 )
at org . apache . catalina . authenticator . AuthenticatorBase . invoke ( AuthenticatorBase . java : 462 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 164 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 100 )
at org . apache . catalina . valves . AccessLogValve . invoke ( AccessLogValve . java : 562 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 118 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 395 )
at org . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 250 )
at org . apache . coyote . http11 . Http11Protocol$Http11ConnectionHandler . process ( Http11Protocol . java : 188 )
at org . apache . coyote . http11 . Http11Protocol$Http11ConnectionHandler . process ( Http11Protocol . java : 166 )
at org . apache . tomcat . util . net . JIoEndpoint$SocketProcessor . run ( JIoEndpoint . java : 302 )
at java . util . concurrent . ThreadPoolExecutor$Worker . runTask ( Unknown Source )
at java . util . concurrent . ThreadPoolExecutor$Worker . run ( Unknown Source )
at java . lang . Thread . run ( Unknown Source )
Caused by : java . lang . NullPointerException
at br . com . repositorio . UsuarioRep . getUsuarios ( UsuarioRep . java : 23 )
at br . com . bean . UsuarioBean . getUsuarios ( UsuarioBean . java : 24 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at javax . el . BeanELResolver . getValue ( BeanELResolver . java : 87 )
at javax . el . CompositeELResolver . getValue ( CompositeELResolver . java : 67 )
at com . sun . faces . el . FacesCompositeELResolver . getValue ( FacesCompositeELResolver . java : 71 )
at org . apache . el . parser . AstValue . getValue ( AstValue . java : 169 )
at org . apache . el . ValueExpressionImpl . getValue ( ValueExpressionImpl . java : 189 )
at com . sun . faces . facelets . el . TagValueExpression . getValue ( TagValueExpression . java : 106 )
... 34 more
CHAMANDO O REPOSITÓRIO !!
fredericomaia10 8 de set. de 2011
Acredito que o seu EntityManager continua não sendo injetado.
Posta o código dos filtros JPA que você criou.
jv.nicocelli 8 de set. de 2011
nel, tentei sim como você falou mais tambem não deu.
Estou utilizando o apache tomcat 7.
Segue código do persistence.xml e do FiltroJPa.
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version= "1.0" xmlns= "http://java.sun.com/xml/ns/persistence" >
<persistence-unit name= "crep" >
<provider> org.hibernate.ejb.HibernatePersistence</provider>
<class> br.com.bean.Usuario</class>
<properties>
<property name= "hibernate.dialect"
value= "org.hibernate.dialect.MySQLDialect" />
<property name= "hibernate.hbm2ddl.auto" value= "update" />
<property name= "hibernate.show_sql" value= "true" />
<property name= "hibernate.format_sql" value= "true" />
<property name= "javax.persistence.jdbc.driver"
value= "com.mysql.jdbc.Driver" />
<property name= "javax.persistence.jdbc.url"
value= "jdbc:mysql://localhost/crep" />
<property name= "javax.persistence.jdbc.user" value= "root" />
<property name= "javax.persistence.jdbc.password" value= "" />
</properties>
</persistence-unit>
</persistence>
JPAFilter.java
package br.com.filtros ;
import java.io.IOException ;
import javax.persistence.EntityManager ;
import javax.persistence.EntityManagerFactory ;
import javax.persistence.Persistence ;
import javax.servlet.Filter ;
import javax.servlet.FilterChain ;
import javax.servlet.FilterConfig ;
import javax.servlet.ServletException ;
import javax.servlet.ServletRequest ;
import javax.servlet.ServletResponse ;
import javax.servlet.annotation.WebFilter ;
@WebFilter ( servletNames = { "Faces Servlet" })
public class JPAFilter implements Filter {
private EntityManagerFactory factory ;
public JPAFilter () {
// TODO Auto-generated constructor stub
}
public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException {
EntityManager entityManager = this . factory . createEntityManager ();
request . setAttribute ( "entityManager" , entityManager );
entityManager . getTransaction (). begin ();
chain . doFilter ( request , response );
try {
entityManager . getTransaction (). commit ();
} catch ( Exception e ){
entityManager . getTransaction (). rollback ();
} finally {
entityManager . close ();
}
}
public void init ( FilterConfig fConfig ) throws ServletException {
this . factory = Persistence . createEntityManagerFactory ( "crep" );
}
public void destroy () {
this . factory . close ();
}
}
fredericomaia10 8 de set. de 2011
Estranho, aparentemente está tudo certo.
nel a anotação @PersitenceContext não vai funcionar, só server para Servidores JEE, o Tomcat é só um Web Containter, não consegue injetar sozinho os EntityManager.
fredericomaia10 8 de set. de 2011
nicocelli você está deixando a criação das tabelas do Banco de Dados para a JPA fazer, certo?
As tabelas e colunas foram criadas automaticamente quando você acessou a aplicação? Verifique seu BD.
jv.nicocelli 8 de set. de 2011
fredericomaia,
Quando eu inicializei o Tomcat as tabelas foram geradas.
Segue o log do startup do Tomcat.
08 / 09 / 2011 16 : 58 : 36 org . apache . catalina . core . AprLifecycleListener init
INFO : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java . library . path : C : \Program Files ( x86 ) \Java \jre6 \bin ; C : \Windows \Sun \Java \bin ; C : \Windows \system32 ; C : \Windows ; C : / Program Files ( x86 ) / Java / jre6 / bin / client ; C : / Program Files ( x86 ) / Java / jre6 / bin ; C : / Program Files ( x86 ) / Java / jre6 / lib / i386 ; C : \oracle \product \10.2 . 0 \client_1 \bin ; C : \Oracle \bin ; C : \Program Files \Common Files \Microsoft Shared \Windows Live ; C : \Program Files ( x86 ) \Common Files \Microsoft Shared \Windows Live ; D : \oracle \product \10.2 . 0 \client_2 \bin ; C : \Windows \system32 ; C : \Windows ; C : \Windows \System32 \Wbem ; C : \Windows \System32 \WindowsPowerShell \v1 . 0 \; C : \Program Files ( x86 ) \Windows Live \Shared ; C : \webserv \bin ; C : \Program Files ( x86 ) \Programas SPED \Visualizador \lib \windows \x86 ; C : \Program Files ( x86 ) \Common Files \Siemens \HiPath ProCenter ; C : \Program Files ( x86 ) \Java \jdk1 . 6.0 _25 \bin ; C : \eclipse ;; .
08 / 09 / 2011 16 : 58 : 36 org . apache . tomcat . util . digester . SetPropertiesRule begin
AVISO : [ SetPropertiesRule ]{ Server / Service / Engine / Host / Context } Setting property 'source' to 'org.eclipse.jst.jee.server:crep' did not find a matching property .
08 / 09 / 2011 16 : 58 : 36 org . apache . coyote . AbstractProtocolHandler init
INFO : Initializing ProtocolHandler [ "http-bio-8080" ]
08 / 09 / 2011 16 : 58 : 36 org . apache . coyote . AbstractProtocolHandler init
INFO : Initializing ProtocolHandler [ "ajp-bio-8009" ]
08 / 09 / 2011 16 : 58 : 36 org . apache . catalina . startup . Catalina load
INFO : Initialization processed in 941 ms
08 / 09 / 2011 16 : 58 : 36 org . apache . catalina . core . StandardService startInternal
INFO : Starting service Catalina
08 / 09 / 2011 16 : 58 : 36 org . apache . catalina . core . StandardEngine startInternal
INFO : Starting Servlet Engine : Apache Tomcat / 7.0 . 12
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jstl / core is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jstl / sql_rt is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jsp / jstl / sql is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jstl / core_rt is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jsp / jstl / core is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jsp / jstl / functions is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jstl / fmt is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // jakarta . apache . org / taglibs / standard / permittedTaglibs is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jstl / xml is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // jakarta . apache . org / taglibs / standard / scriptfree is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jstl / fmt_rt is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jsp / jstl / fmt is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jsp / jstl / xml is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jstl / xml_rt is already defined
08 / 09 / 2011 16 : 58 : 44 org . apache . catalina . startup . TaglibUriRule body
INFO : TLD skipped . URI : http : // java . sun . com / jstl / sql is already defined
08 / 09 / 2011 16 : 58 : 44 com . sun . faces . config . ConfigureListener contextInitialized
INFO : Inicializando Mojarra 2.0 . 3 ( FCS b03 ) para o contexto '/crep'
08 / 09 / 2011 16 : 58 : 45 com . sun . faces . spi . InjectionProviderFactory createInstance
INFO : JSF1048 : Anotações PostConstruct / PreDestroy presentes . Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas .
08 / 09 / 2011 16 : 58 : 45 com . sun . faces . mgbean . BeanManager addBean
AVISO : JSF1074 : O bean gerenciado denominado 'usuarioBean' já foi registrado . Substituindo o tipo de classe do bean gerenciado br . com . bean . UsuarioBean por br . com . bean . UsuarioBean .
08 / 09 / 2011 16 : 58 : 45 org . richfaces . javascript . ClientServiceConfigParser parse
AVISO : Found JavaScript function definition for class javax . validation . constraints . NotNull , but that class is not presented
08 / 09 / 2011 16 : 58 : 45 org . richfaces . javascript . ClientServiceConfigParser parse
AVISO : Found JavaScript function definition for class org . hibernate . validator . constraints . NotEmpty , but that class is not presented
08 / 09 / 2011 16 : 58 : 45 org . richfaces . javascript . ClientServiceConfigParser parse
AVISO : Found JavaScript function definition for class javax . validation . constraints . Size , but that class is not presented
08 / 09 / 2011 16 : 58 : 45 org . richfaces . javascript . ClientServiceConfigParser parse
AVISO : Found JavaScript function definition for class javax . validation . constraints . Pattern , but that class is not presented
08 / 09 / 2011 16 : 58 : 45 org . richfaces . javascript . ClientServiceConfigParser parse
AVISO : Found JavaScript function definition for class javax . validation . constraints . Min , but that class is not presented
08 / 09 / 2011 16 : 58 : 45 org . richfaces . javascript . ClientServiceConfigParser parse
AVISO : Found JavaScript function definition for class javax . validation . constraints . Max , but that class is not presented
08 / 09 / 2011 16 : 58 : 45 org . richfaces . javascript . ClientServiceConfigParser parse
AVISO : Found JavaScript function definition for class javax . validation . constraints . AssertTrue , but that class is not presented
08 / 09 / 2011 16 : 58 : 45 org . richfaces . javascript . ClientServiceConfigParser parse
AVISO : Found JavaScript function definition for class javax . validation . constraints . AssertFalse , but that class is not presented
08 / 09 / 2011 16 : 58 : 45 org . richfaces . cache . CacheManager getCacheFactory
INFO : Selected fallback cache factory
08 / 09 / 2011 16 : 58 : 45 org . richfaces . cache . lru . LRUMapCacheFactory createCache
INFO : Creating LRUMap cache instance using parameters : { org . richfaces . CONTROL_SKINNING = enable , org . richfaces . SKIN = Dark - X , javax . faces . PROJECT_STAGE = Development , javax . faces . STATE_SAVING_METHOD = servidor }
08 / 09 / 2011 16 : 58 : 45 org . richfaces . cache . lru . LRUMapCacheFactory createCache
INFO : Creating LRUMap cache instance of 512 items capacity
08 / 09 / 2011 16 : 58 : 45 org . richfaces . application . InitializationListener onStart
INFO : RichFaces Core Implementation by JBoss , a division of Red Hat , Inc . , version v . 4.0 . 0.20110227 - CR1 SVN r . 21967
08 / 09 / 2011 16 : 58 : 46 com . sun . faces . config . ConfigureListener $ WebConfigResourceMonitor $ Monitor < init >
INFO : Monitoring jndi : / localhost / crep / WEB - INF / faces - config . xml for modifications
0 [ Thread - 2 ] INFO org . hibernate . cfg . annotations . Version - Hibernate Annotations 3.5 . 0 - Final
3 [ Thread - 2 ] INFO org . hibernate . cfg . Environment - Hibernate 3.5 . 0 - Final
4 [ Thread - 2 ] INFO org . hibernate . cfg . Environment - hibernate . properties not found
5 [ Thread - 2 ] INFO org . hibernate . cfg . Environment - Bytecode provider name : javassist
6 [ Thread - 2 ] INFO org . hibernate . cfg . Environment - using JDK 1.4 java . sql . Timestamp handling
28 [ Thread - 2 ] INFO org . hibernate . annotations . common . Version - Hibernate Commons Annotations 3.2 . 0. Final
29 [ Thread - 2 ] INFO org . hibernate . ejb . Version - Hibernate EntityManager 3.5 . 0 - Final
117 [ Thread - 2 ] INFO org . hibernate . cfg . AnnotationBinder - Binding entity from annotated class : br . com . bean . Usuario
127 [ Thread - 2 ] INFO org . hibernate . cfg . annotations . EntityBinder - Bind entity br . com . bean . Usuario on table Usuario
137 [ Thread - 2 ] INFO org . hibernate . cfg . AnnotationBinder - Binding entity from annotated class : br . com . bean . Representante
138 [ Thread - 2 ] INFO org . hibernate . cfg . annotations . EntityBinder - Bind entity br . com . bean . Representante on table Representante
140 [ Thread - 2 ] INFO org . hibernate . cfg . AnnotationConfiguration - Hibernate Validator not found : ignoring
150 [ Thread - 2 ] INFO org . hibernate . cfg . search . HibernateSearchEventListenerRegister - Unable to find org . hibernate . search . event . FullTextIndexEventListener on the classpath . Hibernate Search is not enabled .
163 [ Thread - 2 ] INFO org . hibernate . connection . DriverManagerConnectionProvider - Using Hibernate built - in connection pool ( not for production use ! )
163 [ Thread - 2 ] INFO org . hibernate . connection . DriverManagerConnectionProvider - Hibernate connection pool size : 20
163 [ Thread - 2 ] INFO org . hibernate . connection . DriverManagerConnectionProvider - autocommit mode : true
164 [ Thread - 2 ] INFO org . hibernate . connection . DriverManagerConnectionProvider - using driver : com . mysql . jdbc . Driver at URL : jdbc : mysql : // localhost / crep
164 [ Thread - 2 ] INFO org . hibernate . connection . DriverManagerConnectionProvider - connection properties : { user = root , autocommit = true , release_mode = auto }
267 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - RDBMS : MySQL , version : 5.1 . 36 - community - log
268 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - JDBC driver : MySQL - AB JDBC Driver , version : mysql - connector - java - 5.0 . 7 ( $ Date : 2007 - 03 - 09 22 : 13 : 57 + 0100 ( Fri , 09 Mar 2007 ) $ , $ Revision : 6341 $ )
271 [ Thread - 2 ] INFO org . hibernate . dialect . Dialect - Using dialect : org . hibernate . dialect . MySQLDialect
274 [ Thread - 2 ] INFO org . hibernate . engine . jdbc . JdbcSupportLoader - Disabling contextual LOB creation as JDBC driver reported JDBC version [ 3 ] less than 4
274 [ Thread - 2 ] INFO org . hibernate . transaction . TransactionFactoryFactory - Transaction strategy : org . hibernate . transaction . JDBCTransactionFactory
274 [ Thread - 2 ] INFO org . hibernate . transaction . TransactionManagerLookupFactory - No TransactionManagerLookup configured ( in JTA environment , use of read - write or transactional second - level cache is not recommended )
274 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Automatic flush during beforeCompletion (): disabled
274 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Automatic session close at end of transaction : disabled
274 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - JDBC batch size : 15
274 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - JDBC batch updates for versioned data : disabled
275 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Scrollable result sets : enabled
275 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - JDBC3 getGeneratedKeys (): enabled
275 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Connection release mode : auto
275 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Maximum outer join fetch depth : 2
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Default batch fetch size : 1
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Generate SQL with comments : disabled
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Order SQL updates by primary key : disabled
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Order SQL inserts for batching : disabled
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Query translator : org . hibernate . hql . ast . ASTQueryTranslatorFactory
276 [ Thread - 2 ] INFO org . hibernate . hql . ast . ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Query language substitutions : {}
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - JPA - QL strict compliance : enabled
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Second - level cache : enabled
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Query cache : disabled
276 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Cache region factory : org . hibernate . cache . impl . NoCachingRegionFactory
277 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Optimize cache for minimal puts : disabled
277 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Structured second - level cache entries : disabled
277 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Echoing all SQL to stdout
277 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Statistics : disabled
277 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Deleted entity synthetic identifier rollback : disabled
277 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Default entity - mode : pojo
277 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Named query checking : enabled
277 [ Thread - 2 ] INFO org . hibernate . cfg . SettingsFactory - Check Nullability in Core ( should be disabled when Bean Validation is on ): enabled
313 [ Thread - 2 ] INFO org . hibernate . impl . SessionFactoryImpl - building session factory
361 [ Thread - 2 ] INFO org . hibernate . impl . SessionFactoryObjectFactory - Not binding factory to JNDI , no JNDI name configured
363 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - Running hbm2ddl schema update
363 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - fetching database metadata
364 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - updating schema
410 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - table found : crep . representante
410 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - columns : [ codigo , id , empresa ]
410 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - foreign keys : []
410 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - indexes : [ primary ]
437 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - table found : crep . usuario
437 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - columns : [ id , sobrenome , nome ]
437 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - foreign keys : []
437 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - indexes : [ primary ]
438 [ Thread - 2 ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - schema update complete
08 / 09 / 2011 16 : 58 : 46 org . apache . coyote . AbstractProtocolHandler start
INFO : Starting ProtocolHandler [ "http-bio-8080" ]
08 / 09 / 2011 16 : 58 : 46 org . apache . coyote . AbstractProtocolHandler start
INFO : Starting ProtocolHandler [ "ajp-bio-8009" ]
08 / 09 / 2011 16 : 58 : 46 org . apache . catalina . startup . Catalina start
INFO : Server startup in 9822 ms
Michel_M 8 de set. de 2011
Ai amigo a sua query esta certo olha o meu exemplo que eu tenho...
Query q = em.createQuery("SELECT p FROM Categoriaapt p");
Ai amigo o seu problema é com o EntityManager msm ele tenta fazer a conexão e não consegue
pq a sua classe não estão bem mapeadas.
Tenta fazer esse teste para agente constatar se o problema é msm no seu mapeamento:
private static EntityManager em ;
private static EntityManager fabricarEntity () {
try {
em = javax . persistence . Persistence . createEntityManagerFactory ( "hotel" ). createEntityManager (); //Lembrando hotel é o nome do
//meu persistence.xml coloca o seu ai
} catch ( Exception e ) {
System . out . println ( "ERRO NO PERSISTENCE.XML: " + e . getMessage ());
}
return em ;
}
public static EntityManager abreEntity () {
if ( em == null ) {
em = fabricarEntity ();
}
return em ;
}
Ai o que eu fiz ali foi testar se o EntityManager ja existe, isso evita de ficar abrindo vários EntityManager...
Valeu testa ai...se der NullPointerException é erro na sua mapeação das classes...
jv.nicocelli 9 de set. de 2011
nel:
Oi!
Tente o seguinte colega:
@PersistenceUnit(unitName="crep")
EntityManager em;
Link: http://download.oracle.com/javaee/5/tutorial/doc/bnbrm.html#bnbrp
@PersistenceUnit no Java 6
Abraços.
nel, tentei desta forma e também não deu, obrigado pela ajuda.
jv.nicocelli 9 de set. de 2011
Ai amigo o seu problema é com o EntityManager msm ele tenta fazer a conexão e não consegue
pq a sua classe não estão bem mapeadas.
Tenta fazer esse teste para agente constatar se o problema é msm no seu mapeamento:
Olá Michel,
Acabei de realizar o teste que você passou e conectou normalmente :x
Segue abaixo…
0 [ main ] INFO org . hibernate . cfg . annotations . Version - Hibernate Annotations 3.5.0 - Final
11 [ main ] INFO org . hibernate . cfg . Environment - Hibernate 3.5.0 - Final
12 [ main ] INFO org . hibernate . cfg . Environment - hibernate . properties not found
15 [ main ] INFO org . hibernate . cfg . Environment - Bytecode provider name : javassist
18 [ main ] INFO org . hibernate . cfg . Environment - using JDK 1.4 java . sql . Timestamp handling
102 [ main ] INFO org . hibernate . annotations . common . Version - Hibernate Commons Annotations 3.2.0 . Final
108 [ main ] INFO org . hibernate . ejb . Version - Hibernate EntityManager 3.5.0 - Final
312 [ main ] INFO org . hibernate . cfg . AnnotationBinder - Binding entity from annotated class : br . com . bean . Usuario
341 [ main ] INFO org . hibernate . cfg . annotations . EntityBinder - Bind entity br . com . bean . Usuario on table Usuario
375 [ main ] INFO org . hibernate . cfg . AnnotationBinder - Binding entity from annotated class : br . com . bean . Representante
376 [ main ] INFO org . hibernate . cfg . annotations . EntityBinder - Bind entity br . com . bean . Representante on table Representante
379 [ main ] INFO org . hibernate . cfg . AnnotationConfiguration - Hibernate Validator not found : ignoring
396 [ main ] INFO org . hibernate . cfg . search . HibernateSearchEventListenerRegister - Unable to find org . hibernate . search . event . FullTextIndexEventListener on the classpath . Hibernate Search is not enabled .
439 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - Using Hibernate built - in connection pool ( not for production use ! )
439 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - Hibernate connection pool size : 20
439 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - autocommit mode : true
444 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - using driver : com . mysql . jdbc . Driver at URL : jdbc : mysql : // localhost / crep
445 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - connection properties : { user = root , autocommit = true , release_mode = auto }
621 [ main ] INFO org . hibernate . cfg . SettingsFactory - RDBMS : MySQL , version : 5.1.36 - community - log
622 [ main ] INFO org . hibernate . cfg . SettingsFactory - JDBC driver : MySQL - AB JDBC Driver , version : mysql - connector - java - 5.1.12 ( Revision : ${ bzr . revision - id } )
638 [ main ] INFO org . hibernate . dialect . Dialect - Using dialect : org . hibernate . dialect . MySQLDialect
641 [ main ] INFO org . hibernate . engine . jdbc . JdbcSupportLoader - Disabling contextual LOB creation as JDBC driver reported JDBC version [ 3 ] less than 4
642 [ main ] INFO org . hibernate . transaction . TransactionFactoryFactory - Transaction strategy : org . hibernate . transaction . JDBCTransactionFactory
643 [ main ] INFO org . hibernate . transaction . TransactionManagerLookupFactory - No TransactionManagerLookup configured ( in JTA environment , use of read - write or transactional second - level cache is not recommended )
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - Automatic flush during beforeCompletion () : disabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - Automatic session close at end of transaction : disabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - JDBC batch size : 15
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - JDBC batch updates for versioned data : disabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - Scrollable result sets : enabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - JDBC3 getGeneratedKeys () : enabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - Connection release mode : auto
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Maximum outer join fetch depth : 2
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Default batch fetch size : 1
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Generate SQL with comments : disabled
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Order SQL updates by primary key : disabled
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Order SQL inserts for batching : disabled
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Query translator : org . hibernate . hql . ast . ASTQueryTranslatorFactory
645 [ main ] INFO org . hibernate . hql . ast . ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Query language substitutions : {}
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - JPA - QL strict compliance : enabled
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Second - level cache : enabled
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Query cache : disabled
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Cache region factory : org . hibernate . cache . impl . NoCachingRegionFactory
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Optimize cache for minimal puts : disabled
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Structured second - level cache entries : disabled
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Echoing all SQL to stdout
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Statistics : disabled
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Deleted entity synthetic identifier rollback : disabled
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Default entity - mode : pojo
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Named query checking : enabled
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Check Nullability in Core ( should be disabled when Bean Validation is on ) : enabled
671 [ main ] INFO org . hibernate . impl . SessionFactoryImpl - building session factory
785 [ main ] INFO org . hibernate . impl . SessionFactoryObjectFactory - Not binding factory to JNDI , no JNDI name configured
790 [ main ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - Running hbm2ddl schema update
791 [ main ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - fetching database metadata
791 [ main ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - updating schema
813 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - table found : crep . representante
813 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - columns : [ codigo, id, empresa ]
813 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - foreign keys : []
813 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - indexes : [ primary ]
824 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - table found : crep . usuario
825 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - columns : [ id, sobrenome, nome ]
825 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - foreign keys : []
825 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - indexes : [ primary ]
825 [ main ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - schema update complete
Uma outra dúvida, ali no log diz assim 12 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
O hibernate.properties é uma opção para configuração do hibernate, ou é obrigatório te-lo por algum motivo?
Michel_M 9 de set. de 2011
nicocelli:
Michel M:
Ai amigo o seu problema é com o EntityManager msm ele tenta fazer a conexão e não consegue
pq a sua classe não estão bem mapeadas.
Tenta fazer esse teste para agente constatar se o problema é msm no seu mapeamento:
Olá Michel,
Acabei de realizar o teste que você passou e conectou normalmente :x
Segue abaixo…
0 [ main ] INFO org . hibernate . cfg . annotations . Version - Hibernate Annotations 3.5.0 - Final
11 [ main ] INFO org . hibernate . cfg . Environment - Hibernate 3.5.0 - Final
12 [ main ] INFO org . hibernate . cfg . Environment - hibernate . properties not found
15 [ main ] INFO org . hibernate . cfg . Environment - Bytecode provider name : javassist
18 [ main ] INFO org . hibernate . cfg . Environment - using JDK 1.4 java . sql . Timestamp handling
102 [ main ] INFO org . hibernate . annotations . common . Version - Hibernate Commons Annotations 3.2.0 . Final
108 [ main ] INFO org . hibernate . ejb . Version - Hibernate EntityManager 3.5.0 - Final
312 [ main ] INFO org . hibernate . cfg . AnnotationBinder - Binding entity from annotated class : br . com . bean . Usuario
341 [ main ] INFO org . hibernate . cfg . annotations . EntityBinder - Bind entity br . com . bean . Usuario on table Usuario
375 [ main ] INFO org . hibernate . cfg . AnnotationBinder - Binding entity from annotated class : br . com . bean . Representante
376 [ main ] INFO org . hibernate . cfg . annotations . EntityBinder - Bind entity br . com . bean . Representante on table Representante
379 [ main ] INFO org . hibernate . cfg . AnnotationConfiguration - Hibernate Validator not found : ignoring
396 [ main ] INFO org . hibernate . cfg . search . HibernateSearchEventListenerRegister - Unable to find org . hibernate . search . event . FullTextIndexEventListener on the classpath . Hibernate Search is not enabled .
439 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - Using Hibernate built - in connection pool ( not for production use ! )
439 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - Hibernate connection pool size : 20
439 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - autocommit mode : true
444 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - using driver : com . mysql . jdbc . Driver at URL : jdbc : mysql : // localhost / crep
445 [ main ] INFO org . hibernate . connection . DriverManagerConnectionProvider - connection properties : { user = root , autocommit = true , release_mode = auto }
621 [ main ] INFO org . hibernate . cfg . SettingsFactory - RDBMS : MySQL , version : 5.1.36 - community - log
622 [ main ] INFO org . hibernate . cfg . SettingsFactory - JDBC driver : MySQL - AB JDBC Driver , version : mysql - connector - java - 5.1.12 ( Revision : ${ bzr . revision - id } )
638 [ main ] INFO org . hibernate . dialect . Dialect - Using dialect : org . hibernate . dialect . MySQLDialect
641 [ main ] INFO org . hibernate . engine . jdbc . JdbcSupportLoader - Disabling contextual LOB creation as JDBC driver reported JDBC version [ 3 ] less than 4
642 [ main ] INFO org . hibernate . transaction . TransactionFactoryFactory - Transaction strategy : org . hibernate . transaction . JDBCTransactionFactory
643 [ main ] INFO org . hibernate . transaction . TransactionManagerLookupFactory - No TransactionManagerLookup configured ( in JTA environment , use of read - write or transactional second - level cache is not recommended )
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - Automatic flush during beforeCompletion () : disabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - Automatic session close at end of transaction : disabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - JDBC batch size : 15
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - JDBC batch updates for versioned data : disabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - Scrollable result sets : enabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - JDBC3 getGeneratedKeys () : enabled
643 [ main ] INFO org . hibernate . cfg . SettingsFactory - Connection release mode : auto
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Maximum outer join fetch depth : 2
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Default batch fetch size : 1
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Generate SQL with comments : disabled
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Order SQL updates by primary key : disabled
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Order SQL inserts for batching : disabled
644 [ main ] INFO org . hibernate . cfg . SettingsFactory - Query translator : org . hibernate . hql . ast . ASTQueryTranslatorFactory
645 [ main ] INFO org . hibernate . hql . ast . ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Query language substitutions : {}
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - JPA - QL strict compliance : enabled
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Second - level cache : enabled
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Query cache : disabled
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Cache region factory : org . hibernate . cache . impl . NoCachingRegionFactory
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Optimize cache for minimal puts : disabled
646 [ main ] INFO org . hibernate . cfg . SettingsFactory - Structured second - level cache entries : disabled
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Echoing all SQL to stdout
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Statistics : disabled
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Deleted entity synthetic identifier rollback : disabled
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Default entity - mode : pojo
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Named query checking : enabled
649 [ main ] INFO org . hibernate . cfg . SettingsFactory - Check Nullability in Core ( should be disabled when Bean Validation is on ) : enabled
671 [ main ] INFO org . hibernate . impl . SessionFactoryImpl - building session factory
785 [ main ] INFO org . hibernate . impl . SessionFactoryObjectFactory - Not binding factory to JNDI , no JNDI name configured
790 [ main ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - Running hbm2ddl schema update
791 [ main ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - fetching database metadata
791 [ main ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - updating schema
813 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - table found : crep . representante
813 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - columns : [ codigo, id, empresa ]
813 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - foreign keys : []
813 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - indexes : [ primary ]
824 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - table found : crep . usuario
825 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - columns : [ id, sobrenome, nome ]
825 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - foreign keys : []
825 [ main ] INFO org . hibernate . tool . hbm2ddl . TableMetadata - indexes : [ primary ]
825 [ main ] INFO org . hibernate . tool . hbm2ddl . SchemaUpdate - schema update complete
Uma outra dúvida, ali no log diz assim 12 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
O hibernate.properties é uma opção para configuração do hibernate, ou é obrigatório te-lo por algum motivo?
Ola amigo vc não criou aquele hibernate.cfg.xml?..la vc tb tem que fazer o mapeamento de suas classes tb, no hibernate.cfg.xml.
jv.nicocelli 9 de set. de 2011
Michel,
Não criei o hibernate.cfg.xml, talvez o meu problema esteja ai mesmo.
Vou fazer um teste.
Obrigado
jv.nicocelli 8 de nov. de 2011
Bom dia,
Pessoal, ainda não consegui resolver esse problema…
Como que vocês fazem o mapeamento de suas entdades?
Apenas com o arquivo persistence.xml ?
otavius 23 de jan. de 2012
E aí NICOCELI
Vc conseguiu resolver o problema ? Se SIM , posta aí como fez e me ajude a resolver tb .
Valeu
vinicius8891 26 de mar. de 2012
Problema Resolvido??
Estou com o mesmo problema, caso alguém tiver a solução, ou algo pra ajudar, por favor post aí. Obrigado!!
jv.nicocelli 26 de mar. de 2012
vinicius8891:
Problema Resolvido??
Estou com o mesmo problema, caso alguém tiver a solução, ou algo pra ajudar, por favor post aí. Obrigado!!
Bom dia,
O problema foi resolvido sim.
Porém, não sei exatamente onde era o problema, creio que era no mapeamento das classes com o hibernate.
Eu refiz passo a passo os procedimentos de configuração e mapeamento do hibernate e funcionou normalmente.