This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.net.rafaeltuelho.servlets; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.io.UnsupportedEncodingException; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
import java.net.URLEncoder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
JBoss, Home of Professional Open Source | |
Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual | |
contributors by the @authors tag. See the copyright.txt in the | |
distribution for a full listing of individual contributors. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>br.net.rafaeltuelho</groupId> | |
<artifactId>unit1</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<description>JB297 Training</description> | |
<developers> | |
<developer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<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="unit1" transaction-type="JTA"> | |
<provider>org.hibernate.ejb.HibernatePersistence</provider> | |
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> | |
<properties> | |
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> | |
<property name="hibernate.hbm2ddl.auto" value="create-drop"/> | |
<property name="hibernate.show_sql" value="true"/> | |
<property name="hibernate.format_sql" value="true"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Deployment | |
public static Archive<?> createDeployment() { | |
// You can use war packaging... | |
@SuppressWarnings("unused") | |
WebArchive war = ShrinkWrap | |
.create(WebArchive.class, "test.war") | |
.addPackage(Bus.class.getPackage()) | |
// .addAsManifestResource( | |
// new File("src/main/resources/META-INF", | |
// "persistence.xml")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Hibenate JPA Provider --> | |
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> | |
<property name="hibernate.hbm2ddl.auto" value="create-drop" /> | |
<property name="hibernate.show_sql" value="true" /> | |
<property name="hibernate.format_sql" value="true" /> | |
<property name="hibernate.use_sql_coments" value="true" /> | |
<property name="hibernate.generate_statistics" value="true" /> | |
<!-- Infinispan --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void findindAllUsingJpqlQuery() throws Exception { | |
// given | |
String fetchingAllInJpql = "select e from " + ENTITY_NAME | |
+ " e order by e.id"; | |
// when | |
System.out.println("Selecting (using JPQL)..."); | |
List<Entity> entities = em.createQuery(fetchingAllInJpql, | |
Entity.class).getResultList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<persistence version="2.0" 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"> | |
<persistence-unit name="unit3" transaction-type="RESOURCE_LOCAL"> | |
<provider>org.hibernate.ejb.HibernatePersistence</provider> | |
<!-- non-jta-datasource>jdbc/arquillian</non-jta-datasource --> | |
<properties> | |
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> | |
<property name="hibernate.hbm2ddl.auto" value="create-drop"/> | |
<property name="hibernate.show_sql" value="true"/> | |
<property name="hibernate.format_sql" value="true"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in JavaSE environment | |
EntityManagerFactory emf = Persistence.createEntityManagerFactory("sample"); | |
EntityManager em = emf.createEntityManager(); | |
try{ | |
... | |
] | |
finally{ | |
em.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.class | |
# Mobile Tools for Java (J2ME) | |
.mtj.tmp/ | |
# Package Files # | |
*.jar | |
*.war | |
*.ear |
OlderNewer