JBoss Forge - how to use it and extend the functionality


Instalation in Eclipse: Search for "JBoss Tools (Luna)" in Eclipse via:
Help > Eclipse Marketplace...

After instalation open Forge Console and you can create new project with:
[no project] workspace $ new-project --named my-forge-app --topLevelPackage com.example.app

create webapp
[my-forge-app] my-forge-app $ scaffold setup
[my-forge-app] my-forge-app $ persistence setup --provider HIBERNATE --container JBOSS_AS7
[my-forge-app] my-forge-app $ entity --named Person
[my-forge-app] Person.java $ field string --named firstName
[my-forge-app] Person.java $ field string --named lastName
[my-forge-app] Person.java $ field int --named age
[my-forge-app] Person.java $ scaffold from-entity

This will generate the CRUD pages for your model:
scaffold from-entity ~.model.* --scaffoldType faces --overwrite; 

More information in emiliosimoes.blogspot.pt or JBoss Forge tutorial


Instalation in NetBeans

 

Web Article - JDBC Batch Update Example




Approach 1: Jdbc Batch Update using Statement object



Approach 2: Jdbc Batch Update using PreparedStatement
Source: javacodegeeks.com

Testes de Integração com Arquillian - Coimbra JUG - 16ABR2015

Testes de Integração com Arquillian

Quando:
Quinta-feira, 16 de Abril de 2015 - 18:15

Onde:
Departamento de Engenharia Informática - Faculdade de Ciências e Tecnologia
Universidade de Coimbra Pólo II - Pinhal de Marrocos,Coimbra (mapa)

Inscrições:
http://www.meetup.com/Coimbra-JUG/events/221090416/



A apresentação centra-se na utilização da framework de testes de integracao Arquillian (http://arquillian.org/ ). 

Esta ferramenta executa testes reais, num servidor aplicacional real, não recorre `a utilização de mocks. Desta forma, permite simular o comportamento da aplicacao num ambiente muito próximo do que pode ser encontrado nos ambientes de produção. 

Para demonstrar das suas potencialidades, será criada uma aplicação simples, em poucos minutos, usando Weblogic, Jboss Forge e Arquillian.

Web Article - Quartz HelloWorld Example

pom.xml:


 4.0.0
 com.javacodegeeks.snippets.enterprise
 quartzexample
 0.0.1-SNAPSHOT

 
  
   org.quartz-scheduler
   quartz
   2.2.1
  
 


MyApp.java
package com.javacodegeeks.snippets.enterprise.quartzexample;

import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;

import com.javacodegeeks.snippets.enterprise.quartzexample.job.ByeJob;
import com.javacodegeeks.snippets.enterprise.quartzexample.job.HelloJob;

public class MyApp {

 public static void main(String[] args) {
  try {
   JobDetail job1 = JobBuilder.newJob(HelloJob.class).withIdentity("helloJob", "group1").build();

   Trigger trigger1 = TriggerBuilder.newTrigger().withIdentity("simpleTrigger", "group1")
     .withSchedule(SimpleScheduleBuilder.repeatSecondlyForTotalCount(30)).build();   
   Scheduler scheduler1 = new StdSchedulerFactory().getScheduler(); 
   scheduler1.start(); 
   scheduler1.scheduleJob(job1, trigger1); 
   
   JobDetail job2 = JobBuilder.newJob(ByeJob.class).withIdentity("byeJob", "group2").build();
   Trigger trigger2 = TriggerBuilder.newTrigger().withIdentity("cronTrigger", "group2")
     .withSchedule(CronScheduleBuilder.cronSchedule("0/5 * * * * ?")).build();
   Scheduler scheduler2 = new StdSchedulerFactory().getScheduler();
   scheduler2.start(); 
   scheduler2.scheduleJob(job2, trigger2); 
   }
  catch(Exception e){ 
   e.printStackTrace();
  }
 }

}

Source: javacodegeeks

Web Article - Tomcat DataSource JNDI Example


APACHE_TOMCAT_DIR/conf/context.xml:

< Resource auth="Container" 
driverClassName="com.mysql.jdbc.Driver" 
maxActive="100"  maxIdle="30" maxWait="10000"
name="jdbc/TestDB" type="javax.sql.DataSource" 
url="jdbc:mysql://localhost:3306/jcg?rewriteBatchedStatements=true" 
username="username"  password="password" />
web.xml:

MySQL Datasource example 
jdbc/TestDB 
javax.sql.DataSource 
Container 


DBConnection.java:
package com.javacodegeeks.examples;


import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;


/**
 * @author Chandan Singh
 */
public class DBConnection
{
 public static Connection getConnection() throws SQLException, ClassNotFoundException, NamingException
 {
  Context ctx = new InitialContext();
  DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
  Connection connection = ds.getConnection();
                System.out.println(connection);

  return connection;
 }
}




Source: javacodegeeks.com

Oracle Exam - Java SE 7 Programmer I | 1Z0-803


Exam Number :1Z0-803
Associated Certifications:Oracle Certified Associate, Java SE 7 Programmer
Duration:120 minutes
Number of Questions:70
Passing Score63% View passing score policy


Resources:
Book: OCA/OCP Java SE 7 Programmer I & II Study Guide

Powered by Blogger