Author name: greg

Detaching managed entity from entitymanager.

This code will detach a entity from hibernate Entitymanger making it thus unmanaged entity. // Prepare workbook object to be used for cloning. Session session = (Session) entityManager.getDelegate(); session.evict(workbook); // same as detached workbook.setId(null);// Prepare workbook object to be used for cloning. Session session = (Session) entityManager.getDelegate(); session.evict(workbook); // same as detached workbook.setId(null);

Ant BuildException Cannot run program “..\src\protoc”

Error that I am getting when trying to run mvn test on google protobuf library. [INFO] Executing tasks [INFO] ———————————————————————— [ERROR] BUILD ERROR [INFO] ———————————————————————— [INFO] An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "..\src\protoc": CreateProcess error=2, The system c annot find the file specified   [INFO] ———————————————————————— [INFO] For more information, …

Ant BuildException Cannot run program “..\src\protoc” Read More »

Ant BuildException Cannot run program “..\src\protoc”

Error that I am getting when trying to run mvn test on google protobuf library. [INFO] Executing tasks [INFO] ———————————————————————— [ERROR] BUILD ERROR [INFO] ———————————————————————— [INFO] An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "..\src\protoc": CreateProcess error=2, The system c annot find the file specified   [INFO] ———————————————————————— [INFO] For more information, …

Ant BuildException Cannot run program “..\src\protoc” Read More »

Triming leading and trailing new lines with regex.

Here is some regex to trim leading/trailing newlines carriage and spaces returns from some text. Without replacing ‘spaces’ just new lines/carriage returns. ^(\n|\r)+|(\n|\r)+\Z   This will trim also spaces ^(\n|\r|\s)+|(\n|\r|\s)+\ZWithout replacing 'spaces' just new lines/carriage returns. ^(\n|\r)+|(\n|\r)+\Z This will trim also spaces ^(\n|\r|\s)+|(\n|\r|\s)+\Z Quick explanation might be in order. This regex consists of two parts, …

Triming leading and trailing new lines with regex. Read More »

No Dialect mapping for JDBC type: -4

Yet another fun day with hibernate. While working on ResourcePhaseListener for JSF attachment problem I run into following problem while trying to retrieve BLOB from MySQL db. org.hibernate.MappingException: No Dialect mapping for JDBC type: -4 No Dialect mapping for JDBC type: -4org.hibernate.MappingException: No Dialect mapping for JDBC type: -4 No Dialect mapping for JDBC type: …

No Dialect mapping for JDBC type: -4 Read More »