Posts

PostgreSQL bytea and oid

I came across with following issue when i'm trying to save the uploaded file in to the database as a byte array using hibernate, JPA 2.0  annotation with Postgre SQL. even though in this stage i'm pretty much new to Postgre SQL, It has two type of data types to represent the binary data or BLOB, since i'm using hibernate jpa annotations use the annotation @Lob to indicate the byte[] of data to persist as a binary data. @Lob   @Basic(fetch = FetchType.LAZY)  public byte[] getPicture() { return picture;  }    exception : java.sql.SQLException: ERROR: column "picture" is of type bytea but expression is of type oid   Then i understood the issue with the data types.but when the hibernate generating the table it creates the  column with data type "oid" , after removing this annotation it creates a table column with "bytea" data type. and i'm in doubt which would be the most suitable data type to use.   Then i found the difference...

Add Captcha to Application

When i'm searching for a Captcha API written in java to embedded with my vaadin application, i have found out SimpleCaptcha SimpleCaptcha is a framework used in generating CAPTCHA image/answer pairs for Java (J2EE, Grails, JavaFX, etc.). It is intended to be simple to implement and provide sensible defaults, while having the ability to be customized in a wide variety of ways. Example implementations are provided in Java/J2EE and Grails. Apply the simple captcha is a two step process. Captcha captcha = new Captcha . Builder ( 200 , 50 ) .addText() .addBackground() .addNoise() .gimp() .addBorder() .build();  above line would create captch image and this captcha object has  the image and the answer. now you can apply this in anywhere you need in your application. Link : http://simplecaptcha.sourceforge.net/       JCAPTCHA Stands for J ava C ompletely A utomated P ublic T ...

Open Source NoSQL Databases

NoSQL has started as an alternative to the relational databases. Scalability has become the biggest motivation factor behind the NoSQL. Usually releational databases do not support well to the kind of horizontal scalbility that's required for large-scale social networks or cloud applications. NoSQL is a movement that aims to re-examine the way we structure data and draw attention to innovation in hopes to finding the solution to the next generation's data persistance problems. Reference and more detail please visit : NoSQL

Hibernate Exception - Simultaneously Fetch Multiple Bags

Hibernate Exception - Simultaneously Fetch Multiple Bags One of my customers has just upgraded to JBoss 4.0.4-GA, the process also required us to upgrade Hibernate products to the following versions: Hibernate core – 3.2.0CR2 Hibernate Entity Manager – 3.2.0CR1 Hibernate annotations- 3.2.0CR1 We fixed some minor changes and improvements and then we bumped into the following exception  javax.persistence.PersistenceException: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:217) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114) So what is the problem? When an entity has more than one non-lazy association that might be interpreted as a bag (e.g., java.util.List or java.util.Collection properties annotated with @org.hibernate.annotations.CollectionOfElements or @OneToMany or @ManyToMany and not ...

Vaadin And Spring Integration

This is my documentation for the steps that i have followed to integrate the Spring with the Vaadin. web.xml changes So first we need to add the Spring Context listener to load the bean configuration file. <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> Add the Spring Servlet to intercept Vaadin requests   <servlet> <servlet-name>VaadinSpringServlet</servlet-name> <servlet-class>com.dhaval.web.vaadin.spring.servlet.SpringApplicationServlet</servlet-class> <init-param> <param-name>applicationBean</param-name> <param-value>testApplication</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name...

Installing Spring Tool Suite (STS) under Eclipse 3.5 Galileo

Firstly you need to install Eclipse 3.5 Galileo, then once that’s up and running you can use the Spring update site to install the Spring Tool Suite (STS). Follow these simple step-by-step instructions. I’m assuming that you are the only Java developer using this machine. 1. Go to http://www.eclipse.org/downloads/ 2. Follow the link for Eclipse IDE for Java EE Developers (189 MB) for Windows. 3. Select a mirror and download the file. 4. Create a folder called c:\java. 5. Move the Eclipse archive (eclipse-jee-galileo-win32.zip) into c:\java and extract here. 6. Folder c:\java\eclipse will be created. 7. Drag the executable eclipse.exe on to the desktop (or quick launch) and make a shortcut. 8. The workspace dialogue will pop up and ask you where you would like to keep your workspace. Spaces in file names (or directories) are always a bad idea especially when developing under a Windows environment which is why I don’t accept the default workspace location...

OpenLDAP installation and configuration.

In the openLDAP installation and configuration README I followed they were asked to install the latest version of Berkely DB. At the moment I was installing it was 4.8.26 but after installing it I was unable to up the server. [ ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1) ] error was appeared. Finally I found the reason and it worked for me. In the LDAP release notes it is stated that the most stable version of Berkely DB for openldap_2.4.21 is db-4.7.25. Then I install this version and reconfigure the LDAP server. It worked fine. Here are the full steps that I have followed. I installed it on top of the SSL. Installing Berkely db-4.7.25. Download the compatible version (for your particular LDAP version) of Berkeley DB f rom http://www.sleepycat.com/download/index.shtml gzip -d db-4.7.25.tar.gz tar xvf db-4.7.25.tar cd db-4.7.25 ../dist/configure –prefix=/usr/local/ make make install Installing TSL(I install openSSL) Dow...