Skip to content

Instantly share code, notes, and snippets.

View PessoaService.java
import com.github.brunodutr.persistence.criteria.service.CriteriaProcessor;
public class PessoaService {
public List<Pessoa> buscarPessoas(FiltroPessoa filtroPessoa) {
return CriteriaProcessor.create(entityManager, Pessoa.class)
.filter(filtroPessoa)
.getResultList();
View FiltroPessoa.java
import com.github.brunodutr.persistence.criteria.annotations.CriteriaEqual;
public class FiltroPessoa {
@CriteriaEqual
private String nome;
@CriteriaEqual
private String sobrenome;
View Query Dinâmica - Criteria Normal.java
/**
* Query dinamica que filtra por nome e sobrenome
*
*/
public List<Pessoa> buscarPessoas(String nome, String sobrenome) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Pessoa> criteriaQuery = criteriaBuilder.createQuery(Pessoa.class);
Root<Pessoa> pessoaRoot = criteriaQuery.from(Pessoa.class);
View BaseIT.java
package example.bdutra.it;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.transaction.UserTransaction;
import example.bdutra.jpa.person.PersonEntity;
View arquillian.xml
<?xml version="1.0" ?>
<arquillian
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<defaultProtocol type="Servlet 3.0" />
<extension qualifier="transaction">
View Deployments.java
package example.bdutra.it;
import org.eu.ingwar.tools.arquillian.extension.suite.annotations.ArquillianSuiteDeployment;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
@ArquillianSuiteDeployment
public class Deployments {
View MessageIT.java
package example.bdutra.it.jms;
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
View ServiceJMX.java
package example.bdutra.it.jmx;
import static javax.management.MBeanServerInvocationHandler.newProxyInstance;
import java.io.IOException;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
View project-it.yml (jms)
swarm:
datasources:
data-sources:
ArquillianDS:
driver-name: myh2
connection-url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
user-name: sa
password: sa
jdbc-drivers:
myh2:
View Producer.java
package example.bdutra.jms;
import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
import java.io.Serializable;
import javax.annotation.Resource;
import javax.ejb.TransactionAttribute;
import javax.jms.ConnectionFactory;
import javax.jms.JMSContext;
You can’t perform that action at this time.