9
respostas

Chamando Procedures pela hibernate sem utilizar uma Entity

olá Galera, estou iniciando um projeto teste e optei em utilizar o hibernate , estou com algumas dúvidas, porém a principal, é:

Eu consigo utilizar chamas de procedures pelo hibernate, puro, sem passar para EntityManager ou algo do genero, gostaria somente de fazer a chamada da proc passando paramentros.

Minhas endidades na aplicação é somente beans, getters e setters.

Tenho essa flexibilidade?

Obrigado.

9 respostas

Bom dia Marcelo. A questão do EntityManager é que ele é a conexão com o banco de dados, ele é o responsável por ligar nossa aplicação ao banco, logo, toda operação de banco(exige conexão) precisamos do EntityManager.

Espero ter ajudado. Abraços

Guilherme, entendi sim, dei uma lida e alterei meu projeto, após resolver alguns problemas estou com o seguinte problema, sei o tópico é diferente, mas se puder me ajudar, estou com o seguinte erro:

[PersistenceUnit: trustdev] Unable to build Hibernate SessionFactory

segue o log do meu wildfly

16:18:28,435 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
16:18:28,707 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
16:18:28,806 INFO  [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.2.1.Final "Tweek" starting
16:18:30,918 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found projeto1-1.0.0-SNAPSHOT.war in deployment directory. To trigger deployment create a file called projeto1-1.0.0-SNAPSHOT.war.dodeploy
16:18:31,020 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
16:18:31,069 INFO  [org.xnio] (MSC service thread 1-7) XNIO version 3.3.0.Final
16:18:31,083 INFO  [org.xnio.nio] (MSC service thread 1-7) XNIO NIO Implementation Version 3.3.0.Final
16:18:31,130 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
16:18:31,168 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017502: Undertow 1.1.8.Final starting
16:18:31,187 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
16:18:31,195 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
16:18:31,220 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
16:18:31,228 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
16:18:31,256 INFO  [org.jboss.as.security] (MSC service thread 1-8) JBAS013170: Current PicketBox version=4.0.21.Final
16:18:31,261 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.8.Final starting
16:18:31,305 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
16:18:31,341 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
16:18:31,372 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
16:18:31,375 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
16:18:31,420 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = h2
16:18:31,569 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default]
16:18:31,569 INFO  [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service
16:18:31,784 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path C:\wildfly-8.2.1.Final/welcome-content
16:18:32,288 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017525: Started server default-server.
16:18:32,294 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017531: Host default-host starting
16:18:32,299 INFO  [org.jboss.remoting] (MSC service thread 1-7) JBoss Remoting version 4.0.7.Final
16:18:32,431 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) JBAS015012: Started FileSystemDeploymentService for directory C:\wildfly-8.2.1.Final\standalone\deployments
16:18:32,434 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "projeto1-1.0.0-SNAPSHOT.war" (runtime-name: "projeto1-1.0.0-SNAPSHOT.war")
16:18:32,646 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017519: Undertow HTTP listener default listening on localhost/127.0.0.1:8080
16:18:33,251 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
16:18:33,476 INFO  [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
16:18:35,079 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry orai18n-mapping.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,080 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry orai18n-utility.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,080 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry orai18n-collation.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,081 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry orai18n-translation.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,082 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry orai18n-net.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,082 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry orai18n-servlet.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,083 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry orai18n-lcsd.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,083 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry orai18n-tools.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,084 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015960: Class Path entry gdk_custom.jar in /C:/wildfly-8.2.1.Final/standalone/deployments/projeto1-1.0.0-SNAPSHOT.war/WEB-INF/lib/orai18n-11.2.0.3.0.jar  does not point to a valid jar for a Class-Path reference.
16:18:35,866 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016002: Processing weld deployment projeto1-1.0.0-SNAPSHOT.war
16:18:36,396 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-3) HV000001: Hibernate Validator 5.1.3.Final
16:18:36,436 INFO  [org.hibernate.validator.internal.xml.ValidationXmlParser] (MSC service thread 1-3) HV000007: META-INF/validation.xml found. Parsing XML based configuration.
16:18:37,066 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.1)
16:18:37,068 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016005: Starting Services for CDI deployment: projeto1-1.0.0-SNAPSHOT.war
16:18:37,113 INFO  [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900: 2.2.6 (Final)
16:18:37,174 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = projeto1-1.0.0-SNAPSHOT.war_oracle.jdbc.OracleDriver_11_1
16:18:37,176 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016008: Starting weld service for deployment projeto1-1.0.0-SNAPSHOT.war
16:18:39,595 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017534: Registered web context: /projeto1-1.0.0-SNAPSHOT
16:18:39,658 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "projeto1-1.0.0-SNAPSHOT.war" (runtime-name : "projeto1-1.0.0-SNAPSHOT.war")
16:18:39,818 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
16:18:39,819 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
16:18:39,820 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.1.Final "Tweek" started in 11790ms - Started 658 of 712 services (92 services are lazy, passive or on-demand)
16:18:48,996 INFO  [br.com.caelum.vraptor.core.DefaultConverters] (default task-2) Registering bundled converters
16:18:49,006 INFO  [br.com.caelum.vraptor.core.DefaultConverters] (default task-2) Registering bundled converters
16:18:49,115 INFO  [br.com.caelum.vraptor.http.route.DefaultRouteBuilder] (default task-2) /usuario/lista                                    [ALL] -> public void br.com.trust.ctms.controllers.UsuarioController.listUsuario(br.com.trust.ctms.to.UsuarioTO)
16:18:49,117 INFO  [br.com.caelum.vraptor.http.route.DefaultRouteBuilder] (default task-2) /usuario/add                                      [ALL] -> public void br.com.trust.ctms.controllers.UsuarioController.addUsuario(br.com.trust.ctms.to.LoginTO)
16:18:49,126 INFO  [br.com.caelum.vraptor.http.route.DefaultRouteBuilder] (default task-2) /usuario                                          [ALL] -> public void br.com.trust.ctms.controllers.UsuarioController.usuario()
16:18:49,150 INFO  [br.com.caelum.vraptor.http.route.DefaultRouteBuilder] (default task-2) /empresa                                          [GET] -> public void br.com.trust.ctms.controllers.EmpresaController.empresa()
16:18:49,154 INFO  [br.com.caelum.vraptor.http.route.DefaultRouteBuilder] (default task-2) /home                                             [GET] -> public void br.com.trust.ctms.controllers.HomeController.home()
16:18:49,210 INFO  [br.com.caelum.vraptor.http.route.DefaultRouteBuilder] (default task-2) /placa/consultaPlaca                              [ALL] -> public void br.com.trust.ctms.controllers.PlacaController.consultaPlaca()
16:18:49,218 INFO  [br.com.caelum.vraptor.http.route.DefaultRouteBuilder] (default task-2) /                                                 [GET] -> public void br.com.trust.ctms.controllers.LoginController.login()
16:18:49,220 INFO  [br.com.caelum.vraptor.http.route.DefaultRouteBuilder] (default task-2) /efetuarlogin                                     [POST] -> public void br.com.trust.ctms.controllers.LoginController.efetuarLogin(br.com.trust.ctms.to.LoginTO)
16:18:49,271 INFO  [br.com.caelum.vraptor.VRaptor] (default task-2) VRaptor 4.1.4 successfuly initialized
16:18:49,407 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-2)  * ACESSO * 
16:18:49,408 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-2) Metodo = usuario
16:18:54,843 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-10)  * ACESSO * 
16:18:54,844 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-10) Metodo = listUsuario
16:18:54,847 INFO  [org.hibernate.validator.internal.xml.ValidationXmlParser] (default task-10) HV000007: META-INF/validation.xml found. Parsing XML based configuration.
16:18:54,920 INFO  [br.com.trust.ctms.controllers.UsuarioController] (default task-10) Lista Usuários
16:18:54,981 INFO  [org.hibernate.jpa.internal.util.LogHelper] (default task-10) HHH000204: Processing PersistenceUnitInfo [
    name: trustdev
    ...]
16:18:55,075 INFO  [org.hibernate.Version] (default task-10) HHH000412: Hibernate Core {4.3.9.Final}
16:18:55,078 INFO  [org.hibernate.cfg.Environment] (default task-10) HHH000206: hibernate.properties not found
16:18:55,081 INFO  [org.hibernate.cfg.Environment] (default task-10) HHH000021: Bytecode provider name : javassist
16:18:55,268 INFO  [org.hibernate.annotations.common.Version] (default task-10) HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
16:18:55,298 WARN  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-10) HHH000402: Using Hibernate built-in connection pool (not for production use!)
16:18:55,299 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-10) HHH000401: using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@197.0.0.254:1521:trustdev]
16:18:55,299 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-10) HHH000046: Connection properties: {user=ctms11g, password=****}
16:18:55,299 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-10) HHH000006: Autocommit mode: false
16:18:55,301 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-10) HHH000115: Hibernate connection pool size: 20 (min=1)
16:18:55,599 INFO  [org.hibernate.dialect.Dialect] (default task-10) HHH000400: Using dialect: org.hibernate.dialect.OracleDialect
16:18:55,605 WARN  [org.hibernate.dialect.Oracle9Dialect] (default task-10) HHH000063: The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead
16:18:55,607 WARN  [org.hibernate.dialect.OracleDialect] (default task-10) HHH000064: The OracleDialect dialect has been deprecated; use Oracle8iDialect instead
16:18:55,759 WARN  [br.com.caelum.vraptor.environment.DefaultEnvironment] (default task-10) Could not find the file 'environment.properties' to load.
16:18:55,759 WARN  [br.com.caelum.vraptor.environment.DefaultEnvironment] (default task-10) Could not find the file 'development.properties' to load.
16:18:55,761 WARN  [br.com.caelum.vraptor.environment.DefaultEnvironment] (default task-10) Could not find the file 'environment.properties' to load.
16:18:55,762 WARN  [br.com.caelum.vraptor.environment.DefaultEnvironment] (default task-10) Could not find the file 'development.properties' to load.

Que bom Marcelo, vamos para a próxima!

Pode colar aqui o persistence.xml ?

Guilherme, segue.

<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_2_0.xsd"
    version="2.0">

    <persistence-unit name="trustdev" transaction-type="RESOURCE_LOCAL">

        <!-- provedor/implementacao do JPA -->
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <class>br.com.trust.ctms.to.UsuarioTO</class>
        <properties>
            <!-- dados da conexao -->
            <property name="hibernate.connection.url" value="jdbc:oracle:thin:@197.0.0.254:1521:trustdev" />
            <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver" />            
            <property name="hibernate.connection.username" value="ctms11g" />  
            <property name="hibernate.connection.password" value="ctms" />  
            <property name="hibernate.hbm2ddl.auto" value="create-drop" />

            <!-- propriedades do hibernate -->
            <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />

            <!-- atualiza o banco, gera as tabelas se for preciso -->
            <property name="hibernate.hbm2ddl.auto" value="create-drop" />

        </properties>
    </persistence-unit>
</persistence>

Bom dia Marcelo, tente usar o persistence abaixo por favor:

<persistence version="2.1" 
    xmlns="http://xmlns.jcp.org/xml/ns/persistence" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

    <persistence-unit name="trustdev">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

        <class>br.com.trust.ctms.to.UsuarioTO</class>

        <properties>
            <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@197.0.0.254:1521:trustdev"/>
            <property name="javax.persistence.jdbc.user" value="ctms11g"/>
            <property name="javax.persistence.jdbc.password" 
value="ctms"/>

            <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="false" />
            <!-- poderia ser: update, create, create-drop, none -->
            <property name="hibernate.hbm2ddl.auto" value="update" />
        </properties>
    </persistence-unit>

</persistence>

Guilherme, ainda o mesmo problema.

Unable to build entity manager factory

o engraçado, que deveria dar um erro de conexão, pois estou fora da rede do banco... mas ainda continua no log como se nada tivesse ocorrido, sem erro.

13:49:06,040 INFO  [org.hibernate.jpa.internal.util.LogHelper] (default task-18) HHH000204: Processing PersistenceUnitInfo [
    name: trustdev
    ...]
13:49:06,140 INFO  [org.hibernate.Version] (default task-18) HHH000412: Hibernate Core {4.3.9.Final}
13:49:06,144 INFO  [org.hibernate.cfg.Environment] (default task-18) HHH000206: hibernate.properties not found
13:49:06,147 INFO  [org.hibernate.cfg.Environment] (default task-18) HHH000021: Bytecode provider name : javassist
13:49:06,302 INFO  [org.hibernate.annotations.common.Version] (default task-18) HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
13:49:06,334 WARN  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-18) HHH000402: Using Hibernate built-in connection pool (not for production use!)
13:49:06,336 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-18) HHH000401: using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@197.0.0.254:1521:trustdev]
13:49:06,336 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-18) HHH000046: Connection properties: {user=ctms11g, password=****}
13:49:06,336 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-18) HHH000006: Autocommit mode: false
13:49:06,338 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-18) HHH000115: Hibernate connection pool size: 20 (min=1)
13:49:27,587 WARN  [br.com.caelum.vraptor.environment.DefaultEnvironment] (default task-18) Could not find the file 'environment.properties' to load.
13:49:27,587 WARN  [br.com.caelum.vraptor.environment.DefaultEnvironment] (default task-18) Could not find the file 'development.properties' to load.
13:49:27,588 WARN  [br.com.caelum.vraptor.environment.DefaultEnvironment] (default task-18) Could not find the file 'environment.properties' to load.
13:49:27,589 WARN  [br.com.caelum.vraptor.environment.DefaultEnvironment] (default task-18) Could not find the file 'development.properties' to load.
13:49:42,280 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-19)  * ACESSO * 
13:49:42,281 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-19) Metodo = listUsuario
13:49:42,284 INFO  [br.com.trust.ctms.controllers.UsuarioController] (default task-19) Lista Usuários
13:49:42,317 INFO  [org.hibernate.jpa.internal.util.LogHelper] (default task-19) HHH000204: Processing PersistenceUnitInfo [
    name: trustdev
    ...]
13:49:42,329 WARN  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-19) HHH000402: Using Hibernate built-in connection pool (not for production use!)
13:49:42,330 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-19) HHH000401: using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@197.0.0.254:1521:trustdev]
13:49:42,330 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-19) HHH000046: Connection properties: {user=ctms11g, password=****}
13:49:42,330 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-19) HHH000006: Autocommit mode: false
13:49:42,331 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-19) HHH000115: Hibernate connection pool size: 20 (min=1)
13:50:19,100 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-20)  * ACESSO * 
13:50:19,101 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-20) Metodo = listUsuario
13:50:19,103 INFO  [br.com.trust.ctms.controllers.UsuarioController] (default task-20) Lista Usuários
13:50:19,123 INFO  [org.hibernate.jpa.internal.util.LogHelper] (default task-20) HHH000204: Processing PersistenceUnitInfo [
    name: trustdev
    ...]
13:50:19,140 WARN  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-20) HHH000402: Using Hibernate built-in connection pool (not for production use!)
13:50:19,143 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-20) HHH000401: using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@197.0.0.254:1521:trustdev]
13:50:19,143 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-20) HHH000046: Connection properties: {user=ctms11g, password=****}
13:50:19,143 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-20) HHH000006: Autocommit mode: false
13:50:19,144 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-20) HHH000115: Hibernate connection pool size: 20 (min=1)
13:50:23,064 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-21)  * ACESSO * 
13:50:23,065 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-21) Metodo = usuario
13:50:25,823 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-22)  * ACESSO * 
13:50:25,823 INFO  [br.com.trust.ctms.controllers.AccessInterceptor] (default task-22) Metodo = listUsuario
13:50:25,826 INFO  [br.com.trust.ctms.controllers.UsuarioController] (default task-22) Lista Usuários
13:50:25,841 INFO  [org.hibernate.jpa.internal.util.LogHelper] (default task-22) HHH000204: Processing PersistenceUnitInfo [
    name: trustdev
    ...]
13:50:25,850 WARN  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-22) HHH000402: Using Hibernate built-in connection pool (not for production use!)
13:50:25,851 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-22) HHH000401: using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@197.0.0.254:1521:trustdev]
13:50:25,851 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-22) HHH000046: Connection properties: {user=ctms11g, password=****}
13:50:25,851 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-22) HHH000006: Autocommit mode: false
13:50:25,851 INFO  [org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (default task-22) HHH000115: Hibernate connection pool size: 20 (min=1)

Blz Marcelo, cole aqui as classes onde cria a factory e a EntityManager por favor?

Guilherme segue.

package br.com.trust.ctms.dao;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.enterprise.context.RequestScoped;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;

import br.com.trust.ctms.to.UsuarioTO;

@RequestScoped
public class UsuarioDAO {

    public UsuarioDAO() {

    }
    public void add(UsuarioTO usuario) throws SQLException {
        //this.manager.persist(usuario);
    }

    public List<UsuarioTO> consultaUsuario(UsuarioTO usuario)
            throws SQLException, IOException, ClassNotFoundException, NamingException 
    {
        List<UsuarioTO> usuarios = new ArrayList<>();

        EntityManager manager = Persistence.createEntityManagerFactory("trustdev").createEntityManager();

        usuarios = (List<UsuarioTO>) manager.createQuery("from frt_usu").getResultList();
        return usuarios;
    }

}

"o engraçado, que deveria dar um erro de conexão, pois estou fora da rede do banco... mas ainda continua no log como se nada tivesse ocorrido, sem erro."

Na verdade Marcelo ele não chegou a bater na conexão pois está com erro na persistence-unit. Verifique se o persistence.xml está com os properties iguais a que lhe passei (pois são da JPA e você estava usando do hibernate) e se o arquivo está dentro da pasta WEB-INF dentro de src (voce deve criar esta pasta)