Skip to content

Instantly share code, notes, and snippets.

View pedro-hos's full-sized avatar
🏠
Working from home

Pedro Hos pedro-hos

🏠
Working from home
View GitHub Profile
@pedro-hos
pedro-hos / standalone-datasource.xml
Last active August 29, 2015 14:05
standalone.xml PostgreSQL
<datasource jta="true" jndi-name="java:jboss/datasources/PostgreSQLDS" pool-name="PostgreSQLDS" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/SEU_BD_AQUI</connection-url>
<driver>postgresql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
@pedro-hos
pedro-hos / module.xml
Created August 26, 2014 01:36
Module XML para o PostgreSQL
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:domain:datasources:2.0" name="org.postgresql">
<resources>
<resource-root path="postgresql-9.3-1102.jdbc41.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
@pedro-hos
pedro-hos / standalone_driver.xml
Last active August 29, 2015 14:05
driver do arquivo standalone.xml do WildFly
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
@pedro-hos
pedro-hos / pom.xml
Created September 7, 2014 15:14
Plugin Maven failsafe
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
@pedro-hos
pedro-hos / retornaTipo
Last active August 29, 2015 14:06
Retorna Classe por Reflection
/**
* @author Pedro Hos<br>
*
* Utilizando Exemplo de Eduardo Guerra!
* https://groups.google.com/forum
* /#!topic/projeto-oo-guiado-por-padroes/pOIiOD9cifs
*
* Este método retorna o tipo da Classe, dessa maneira não é
* necessário cada Service expor seu tipo!!!!
*
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
$("#selectBox").append('<option value="option6">option6</option>');
@pedro-hos
pedro-hos / LoggerProducer.java
Last active August 29, 2015 14:12
LoggerProducer
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoggerProducer {
@Produces
public Logger produceLogger(InjectionPoint injectionPoint) {
return LoggerFactory.getLogger(injectionPoint.getMember()
.getDeclaringClass().getName());
@pedro-hos
pedro-hos / Repository.java
Created January 21, 2015 23:07
Uma classe Repositorio abstrata para uso com as entidades do nosso sistema
package br.com.pedroHos.model.repositories;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaQuery;
@pedro-hos
pedro-hos / persistence.xml
Created April 6, 2017 18:07 — forked from mortezaadi/persistence.xml
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<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_1_0.xsd"
version="1.0">
<!-- derby -->