Skip to content

Instantly share code, notes, and snippets.

@ssinganamalla
ssinganamalla / JpaUserRepositoryImpl.java
Created August 16, 2013 00:19
find the single record.
public User findByEmail(String email) {
Query query = this.em.createQuery("SELECT user FROM User u where u.email= :theemail");
query.setParameter("theemail", email);
return (User) query.getSingleResult();
}
@ssinganamalla
ssinganamalla / LoadProperties.java
Created January 12, 2016 23:15
Load config properties file located in resources directory
public static ApplicationProperties loadProperties() {
Properties prop = new Properties();
InputStream input = null;
try {
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
input = classloader.getResourceAsStream("config.properties");
// load a properties file
prop.load(input);