Create a Simple JPA Query

Create a simple PostgreSQL Database Table psql mydb mydb=# create user john with password 'secret'; CREATE ROLE mydb=# create table person( personid serial, name varchar(30), age integer, height decimal (4,2) ); NOTICE: CREATE TABLE will create implicit sequence "person_personid_seq" for serial column "person.personid" CREATE TABLE mydb=# grant all on person to john; GRANT mydb=# GRANT USAGE,... Continue Reading →

Spring Bean Life Cycle

Initialization Callbacks Destruction Callbacks Initialization Callbacks public class Example1 implements InitializingBean { public void afterPropertiesSet() { } } <bean id="exampleBean" class="Example2" init-method="init"/> public class Example2 { public void init() { } } Destruction Callbacks public class Example1 implements DisposableBean { public void destroy() { } } <bean id="exampleBean" destroy-method="destroy"/> public class Example2 { public void... Continue Reading →

Spring Bean Scopes

singleton (default) only one instance per Spring Container prototype any number of instances request scoped to an HTTP request (web-aware Spring ApplicationContext) session scoped to an HTTP session (web-aware Spring ApplicationContext) global-session scoped to a global HTTP session (web-aware Spring ApplicationContext) <bean id="helloWorld" class="Hello" scope="singleton"> </bean> <bean id="helloWorld" scope="prototype"> </bean>

Up ↑

%d bloggers like this: