Search This Blog

Saturday, April 30, 2011

Mariah Carey Melahirkan Bayi Kembar

Penyanyi top dunia mariah carey tengah berbahagia pasalnya ia baru saja melahirkan sepasang anak kembar sabtu kemarin pukul 12 waktu los angeles. Nick Cannon suami mariah carey tentunya juga ikut bersuka cita atas lahirnya anak kembar mereka.

Anak perempuan dari bayi kembar mariah carey ini lahir duluan dan disusul dengan bayi laki laki mariah carey. kedua bayi ini lahir dalam kondisi sehat

Kasus Bondan Prakoso di Twitter

Bondan Prakoso dilaporkan polisi atas kasus penghinaan oleh akasaka bar dan music pub di denpasar bali. intinya status twitter bondan prakoso dianggap telah menghina akasaka bar dan music pub. inilah status twitter bondan prakoso yang dipermasalahkan

"Security=Secure=membuat nyaman= mebuat Aman,Security Bali Aka Saka=Tidak Sopan=Berlebihan=Tidak menghargai Tamu!" tulis Bondan di akun @BondanF2B.

Friday, April 29, 2011

Daftar Pemenang SCTV Music Awards 2011

SCTV Music Awards adalah ajang penghargaan bagi musisi paling ngetop sepanjang tahun 2011, Acara SCTV Music Awards 2011 ini dilangsungkan tadi malam jumat 29 april 2011 di Kemayoran.

ada banyak kategori yang dipilih seperti gitaris terbaik,Drummer terbaik dan juga bassis terbaik lalu album terbaik dan masih banyak lain nya. nah ini dia list daftar pemenang SCTV Music Awards 2011. Wah selamat ya

The Sexy One and Only Claudia Lynx

Claudia Lynx was born in Tehran Iran and she became a young child actress in television commercials at age 5. She later moved to Canada where she persued her career as a child actor. By the age of 15 she was a full time model, and she is very beautiful. She has become a great success and I plan on seeing her in many more movies and tv series. What she is most famous for the movie Succubus: Hell Bent which was a good movie despite its negative reviews. It was a B movie but it still offers everything that is expected from a horror movie. There is nothing better then a sexy blood sucking vampire. Here are some sexy pictures that I have found of Claudia Lynx....




Ramalan Zodiak Aries Minggu Ini

Wah ternyata sudah lama nih nggak posting soal ramalan bintang alias ramalan zodiak. dalam astrologi modern aries dihitung mulai tanggal 21 maret hingga 20 april. nah bagi yang merasa tanggal lahirnya ada di antara tanggal itu berarti zodiak mereka adalah aries. Sebelumnya kami pernah tuh posting soal ramalan zodiak pisces. sekarang bagaimana jika kita simak soal ramalan zodiak aries minggu ini.

Wednesday, April 27, 2011

Berau Membara Download Video MP4

Berau membara adalah judul Video 3gp yang melibatkan anggota PWI berinisial SR dengan seorang Wanita. Aktor dalam Video hot berau membara ini merupakan pegawai bagian humas pemkab berau kaltim. dalam video berdurasi 13 menit 3 detik ini tampak terlihat adegan intim SR bersama dengan seorang wanita. hingga kini kasus video berau membara masih diusut oleh pihak yang berwajib.

Sementara, wanita

Tuesday, April 26, 2011

JSF 2, Spring 3, JPA (Hibernate 3), PostgreSQL, c3p0 - everything together (part 2 of 2)

Requirements:
  • running database and complete project with all required libraries integrated, described in previous post (can be found here)

Step 4 (continued): configuration files - faces-config.xml.

Comparing to a JSF 2.0 project with Spring integrated, only applicationContext.xml file will be changed - web.xml and faces-config.xml files will be the same. We need to add below code into applicationContext.xml:
<bean id="pooledDataSource" 
class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="org.postgresql.Driver" />
<property name="jdbcUrl" value="jdbc:postgresql://localhost:5432/bikes"/>
<property name="user" value="postgres"/>
<property name="password" value="pgpass"/>
<property name="maxPoolSize" value="10" />
<property name="maxStatements" value="0" />
<property name="minPoolSize" value="5" />
</bean>

<bean id="JDBCDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
<property name="driverClassName" value="org.postgresql.Driver"/>
<property name="url" value="jdbc:postgresql://localhost:5432/bikes"/>
<property name="username" value="postgres"/>
<property name="password" value="pgpass"/>
</bean>

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" >
<!--
Specific properties for Hibernate are in persistence.xml file,
but also can be placed here and removed from persistence.xml file.
-->
</bean>
</property>
<property name="dataSource" ref="pooledDataSource" />
<property name="persistenceUnitName" value="persistenceUnit"/>
</bean>

<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

<bean name="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>

<tx:annotation-driven />
Note that this approach is similar to situation when plain Hibernate API is used with Spring: JPA's EntityManagerFactory is like Hibernate's SessionFactory, JPA's EntityManager (obtained from EntityManagerFactory) is like Hibernate's Session (obtained from SessionFactory). JPA's EntityManager is injected into Repositories (with the help of Spring's PersistenceAnnotationBeanPostProcessor class), while Hibernate's Session was injected into DAO's (with the help of Spring's HibernateDaoSupport class exteneded by each DAO). JPA's TransactionManager (built on EntityManagerFactory) is like Hibernate's HibernateTransactionManager (built on SessionFactory).
JPA's Repositories and Services are similar to oldschool DAOs and Facades. Repositories are injected into Services, while DAOs are injected into Facades.

Please note that I defined here two datasources: a basic one without connection pool (JDBCDataSource) and second one using c3p0 as a connection pool (pooledDataSource).

Step 5: configuration files - persistence.xml

In addition JPA uses a special configuration file named persistence.xml. This file contains additional settings for JPA vendor. The location of this file is described in this article. In order to have this file inside WEB-INF/classes/META-INF/persistence.xml under Eclipse, I created a directory "config" where I put META-INF subdirectory with persistence.xml file inside. Then I select the directory "config" to be used as a source directory. This means that content of "config" directory will be on classpath, and for a web application during a build time it will be moved into WEB-INF/classes. Note that I also added there log4j config file:

Persistence.xml file contains some specific settings for Hibernate (as JPA vendor):
<?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">

<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
</persistence>

Step 6: configuration files - log4j.properties

As I wrote before we will use Log4j instead of Hibernate's default SLF4j. Lets's log everything we can (we can see how Hibernate opens/closes connections, how connections are taken from the pool, how Spring manages transactions and so on):
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n
log4j.rootLogger=info,A1

log4j.logger.com.mchange.v2=DEBUG
log4j.logger.org.hibernate=DEBUG
log4j.logger.org.springframework=DEBUG

Step 7: database entities.

As shown at the beginning of previous post, we had only one entity represented by the class Bike.java. Instances of Bike.java where created inside Spring service named bikeDataProvider (BikeDataProviderImp.java). Now we have a database with tables Bike, Bike_Category, Account and Role. For each table we should create one class (note: this is the simplest mapping one table to one class - there are other way to map tables to classes).

Bike entity:
package com.jsfsample.model;

@Entity
@Table(name="bike")
public class Bike implements Serializable {

private Integer id;
private BikeCategory category;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="bike_id")
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}

@ManyToOne
@JoinColumn(name="bike_category_id")
public BikeCategory getCategory() {
return category;
}
public void setCategory(BikeCategory category) {
this.category = category;
}

// rest of columns
}
Bike_category entity:
package com.jsfsample.model;

@Entity
@Table(name="bike_category")
public class BikeCategory {

private Integer categoryId;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="bike_category_id")
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
// rest of columns
}
Account entity:
package com.jsfsample.model;

@Entity
@Table(name="account")
public class Person {

private Integer accountId;
private Role currentRole;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="account_id")
public Integer getAccountId() {
return accountId;
}
public void setAccountId(Integer accountId) {
this.accountId = accountId;
}

@ManyToOne
@JoinColumn(name="role_id")
public Role getCurrentRole() {
return currentRole;
}
public void setCurrentRole(Role currentRole) {
this.currentRole = currentRole;
}
// rest of columns
}
Role entity:
package com.jsfsample.model;

@Entity
@Table(name="role")
public class Role {

private Integer roleId;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="role_id")
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
// rest of columns
}
Note how classes are mapped to tables (using @Table(name="...")) and how fields are mapped to columns (using @Column(name="...")). We also mapped many-to-one relations between tables using @ManyToOne annotation with proper joim column name. Note also how primary keys are generated - we do not use PostgreSQL sequence (GenerationType.SEQUENCE) - PostgreSQL supports SERIAL data type for primary keys, which actually hides sequences (see this link).

Step 8: repositories and services.

Spring repositories are similar to DAO. All database interactions is done insde them. As an example, let's look inside repository resposnible for loading and saving bikes - BikesDAOImpl.java:

package com.jsfsample.repositories.impl;

@Repository("BikesRepository")
public class BikesDAOImpl implements BikesDAO {

private EntityManager em = null;

@PersistenceContext
public void setEntityManager(EntityManager em) {
this.em = em;
}

@Override
public Bike loadSelectedBike(Integer bikeId) {
return em.find(Bike.class, bikeId);
}
// other methods for saving bike and loading bike for given category

}

This repository is used in Spring's service named bikeDataProvider (BikeDataProviderImpl.java):

package com.jsfsample.services.impl;
...
@Service("bikeDataProvider")
public class BikeDataProviderImpl implements BikeDataProvider {

@Resource(name="BikesRepository")
private BikesDAO bikesRepository;

@Resource(name="DictionaryRepository")
private DictionariesDAO dictionaryRepository;

public Bike getBikeById(Integer id){
return bikesRepository.loadSelectedBike(id);
}

@Transactional
public void add(Bike newBike, Integer categoryId) {
BikeCategory categorySelected = dictionaryRepository.loadBikeCategroryById(categoryId);
newBike.setCategory(categorySelected);
bikesRepository.saveBike(newBike);
}

// other methods using repositories
}
Similar solution is used for account (person) repository which is then used in Spring's Security service named userDetailsService (UserDetailsServiceImpl.java). Note how easy is to execute a method within database transaction - just use @Transactional annotation and voila.

That's all about adding JPA into Spring-based JSF2 sample application.

The rest of application code (web pages, JSF managed beans) are the same as in pure Spring example project - we only modified services by providing repositories.

How to test it? After deploying application on the server and starting the server, we have to open a browser and type in URL:

http://localhost:8080/JSF2FeaturesSpringJPA


-------------------------------------------
Download source files:
Note: make sure that Java, Eclipse and Tomcat are properly installed and configured for running the project (additional configuration may be required if different directories are used).

Eclipse complete sample project is here (with all required libraries). The sample project is a ready to run application which contains JPA (Hibernate), Spring (with Spring Security). You can also download a war file located here (just copy it inside webapps folder in Your Tomcat and start Tomcat with the script startup.bat). Make sure that before doing this You created required database and PostgreSQL server is up and running (You can check access using pgAdmin III).

Sunday, April 24, 2011

Foto Foto Konser Justin Bieber di Sentul


Foto Konser Justin bieber 23 april 2011 - Justin Bieber idola remaja asal kanada melangsungkan konser nya di Sentul City Center kemarin malam 23 april 2011. Konser justin bieber ini merupakan salah satu konser yang paling dinantikan. tidak hanya oleh remaja bahkan juga ibu ibu yang menyebut diri mereka sebagai Beliebers (sebutan fans bagi justin bieber). justin bieber memang fenomenal.

Walaupun

Friday, April 15, 2011

Penyanyi Arie Wibowo Meninggal Dunia

Penyanyi legendaris indonesia Arie Wibowo meninggal dunia. satu lagi seniman dan selebritis indonesia meninggal dunia. Penyanyi yang terkenal di tahun 80 an dengan lagu madu dan racun ini menghembuskan nafas terakhir nya kamis 14 April 2011 di Rumah Sakit Islam Cempaka Putih. Penyanyi yang identik dengan kacamata hitam ini wafat pada usia 59 tahun. Jenazah dikuburkan di Taman Pemakaman Umum

Wednesday, April 13, 2011

Amy Winehouse Was a Mess But She Still Used to Be Hot

We here at drunk celebrities don't like to make fun of people, or act like stupid paparazzi papers. We try to remain focused on hot pictures. Although Amy Winehouse has been on a constant battle with her substance abuse, and maybe mental health issues, it doesn't mean that she was/is smoking hot. She has made a lot of money and she has one of the best female Contralto voice that I know. That means she has a beautiful deep singing voice that is very hard to pull off. A lot of her songs are catchy, and I'm wondering if she is going to get off of this drug habit and go back to making good music that we all enjoy. Good luck Amy Winehouse. Here are some hot photos I have found of Amy on the Internet....





Triunfo Del Amor Capitulo 125 Recap

Triunfo del amor the famous telenovela now are on capitulo 125, have you watch the video of triunfo del amor capitulo 125? Here's some of the Triunfo del amor capitulo 125 recap for telenovela lover. there's so many blog write about the recap of this telenovela online. I wonder why? Is it due to the popularity of this telenovela? After you watch capitulo 124 of this telenovela i think you have to

Monday, April 11, 2011

Cinta Farhat Norman Kamaru Video Download

Sudah dengar lagu cinta farhat yang dinyanyikan oleh briptu norman kamaru si polisi gorontalo yang tenar sejak lip sync lagu chal chaya chaya. lagu cinta farhat ini merupakan lagu ciptaan farhat abbas yang dikenal sebagai pengacara. norman rekaman lagu ini di studio rekaman milik farhat abbas saat dia kemarin ada di jakarta.

Tak tanggung-tanggung, Briptu Norman menyanyikan lima lagu karangan

Friday, April 8, 2011

Lagu Peterband Ada ajah Denganmu

Peterband ada ajah dengan mu download MP3. sayangnya saya belum dengar tuh lagu band peterband yang berjudul ada ajah dengan mu. Sekedar informasi saja Peterband adalah band bentukan dari Pangeran Cinta Management pimpinan Charlie ST12. Peterband sepertinya adalah plesetan dari peterpan. bahkan vokalis peterband pun yang nama asli nya fahrul di panggil arul. arul peterband memang memiliki rupa

Thursday, April 7, 2011

Lily Collins is Really Hot and Sexy

Lilly Collins is the daughter of Phil Collins and his second wife Jill Tavelman. She is also the half sister of Joely Collins. Lilly Collins is very beautiful and she is attending the University of Southern California. She has a major in Broadcast Journalism. She started acting when she was only 2 years old in the popular television series Growing Pains. When she was 5 she moved to the United States and began performing at The Youth Academy for Dramatic Arts. She is not only talented be being a great actress but she also is a great writer too. She has written for a number of magazines including: Teen Vogue, Los Angeles Times, and Seventeen. She has a great personality, and you haven't seen her go nuts on any paparazzi yet. Here are some really hot pics that I have found of her on the internet...





Foto Nakal Sheila Marcia Download

Foto nakal yang mirip sheila marcia beredar di internet. sheila marcia kabarnya juga sudah mengakui bahwa foto tersebut memang betul diri nya. Foto nakal sheila marcia ini beredar menjelang pernikahan sheila marcia dengan kiki mirano drummer band cannon ball. simak gosip sheila marcia soal anak hasil hubungannya dengan anji drive beberapa tahun silam.

Kuasa hukum Sheila, Ferry Juan saat

Wednesday, April 6, 2011

Malinda Dee | Inong Melinda Foto Terbaru

Melinda Dee alias Inong Malinda beberapa minggu ini bak selebritis dan banyak diberitakan oleh media. Karyawati Citibank senior dengan pangkat vice president ini terkait kasus meraup uang nasabah 17 Milliar rupiah. memang sih melinda dee alias MD sudah di tahan saat ini dan sedang menunggu proses hukum atas diri nya. mobil mewah malinda juga sudah disita oleh polisi salah satunya adalah Ferrari

Tuesday, April 5, 2011

Briptu Norman Kamaru Polisi Celeb Youtube

Norman Kamaru Polisi Manado ups Gorontalo yang berpangkat brigadir satu sejak kemarin menjadi celeb berkat video lip sync Chal Chaya chaya di Youtube. Norman dengan sempurna melakukan lip sync lagu india tersebut sepertinya dia memang hapal dengan lirik lagu itu. Namun aksi kocak norman kamaru ini berbuntut pada hukuman.

Menurut berita dari berbagai portal berita, Norman Kamaru akan ditindak

Akibat Pergaulan Bebas 2 Sinopsis | Trailer Video

Film Akibat Pergaulan Bebas 2 adalah film yang diangkat dari kisah nyata yang menimpa ariel, luna maya dan cut tari. saya yakin semua orang tau kisah nyata tersebut. seperti apa sinopsis dari akibat pergaulan bebas 2 ini? Film Akibat Pergaulan Bebas 2 ini Di Sutradarai oleh Findo Purnomo dan ditulis oleh aviv elham.

Berikut adalah Sinopsis Akibat Pergaulan Bebas 2

Alkisah, tokoh Denis dan

Monday, April 4, 2011

Video Polisi Gorontalo Menggila

Polisi Gorontalo Menggila Mp4 adalah judul video youtube terbaru yang menampilkan adegan seorang polisi di gorontalo yang beraksi lucu dan konyol yang melakukan lip sync lagu india chaiya chaiya.

Jika dilihat dari gaya mulutnya, sepertinya polisi gorontalo yang menggila ini hapal dengan lirik lagu india chaiya chaiya. di dalam video tersebut tampak jelas dia sangat percaya diri mengikuti gerakan