Monthly Archives April 2012

Starting with JPA with JBoss and MySQL

Environment

  • JBoss 7.1.1
  • MySQL 5.5

Note: Make sure the datasource is configured properly. Visit the post (http://vkslabs.com/adding-mysql-data-store-to-jboss-7-x/) to find out how to configure datasource.

Step 1: Configure persistence.xml

Create a file called persistence.xml and add the following content

<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_2_0.xsd"
version="2.0">
<persistence-unit name="testjpa" transaction-type="RESOURCE_LOCAL">
<jta-data-source>java:jboss/datasources/myDS</jta-data-source>
<class>com.test.StudentBean</class>
<properties>
<property name="hibernate.dialect" value="org...
Read More

Adding MySQL data source to JBoss 7.X

Today I spent almost 4-5 hours figuring how to configure MySQL for JBoss. Since I am new to JEE world it was a real struggle for me. So hopefully this post will help newbies like me…

  1. Download and extract  JBoss v7.1.1 (Download URL : http://www.jboss.org/jbossas/downloads/)
  2. Download and install MySQL (Download URL : http://dev.mysql.com/downloads/)
  3. Download MySQL JDBC driver (Download URL: http://dev.mysql.com/downloads/connector/j/)

Step 1 – Copy JDBC driver to JBoss folder

  • Extract the downloaded JDBC Driver (mysql-connector-java-5.1.19.zip) which contains source, readme files along with the driver JAR file (mysql-connector-java-5.1.19-bin.jar). For now we will be using only this JAR file.
  • Go to the folder JBOSS_HOME\modules\com and create a folder called mysql and inside mysql creat...
Read More

Android Marketplace APIs

Google known for releasing API for every service it offers has still not opened up their marketplace for the developers. There is no official API to access the marketplace and execute a search. But I came across this interesting project that uses the protobuf (The protocol that Google uses for almost all structured data communication).

http://code.google.com/p/android-market-api/

This is a Java implementation of the unofficial marketplace APIs and the site also has links to projects on other languages such as Ruby and PHP. Since this is an unofficial API there are many glitches for instance you cannot search beyond the 500th app details if your search query returns more than 500 results.

Searching by keyword

String query = "india";

AppsRequest appsRequest = AppsRequest.newBuilder()
...
Read More