Browsing the blog archives for June, 2008.

Hibernate Pagination

Examples

The following is an example of Hibernate pagination using the Java persistence libraries:

final Query query  = getEntityManager().createQuery("select n FROM Foo n");
query.setFirstResult(10);
query.setMaxResults(20);
return query.getResultList();
No Comments

Create MySQL Database and User

Examples

Below are the steps to create a MySQL database and add a user

CREATE DATABASE testdb CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@'127.0.0.1' IDENTIFIED BY 'sumthin' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@'localhost' IDENTIFIED BY 'sumthin' WITH GRANT OPTION;

All commands are executed in the MySQL console.

No Comments

Enable SVN Keyword Properties

Config

If you would like SVN to replace keywords and it’s not enabled by default then execute:

svn propset svn:keywords Id FILE_NAME

E.g.,

svn propset svn:keywords Id Test.java

In your source file you need to add: “$Id”.

E.g.

/**
* Test class.
* @author John Smith
* @version $Id$
*/
public class Test {

After you commit the file, it will look something like:

/**
* Test class.
* @author John Smith
* @version $Id: build.xml 10 2008-06-15 18:12:42Z john $
*/
public class Test {
No Comments