azizkhani.net

I know that I know nothing

testing tools

clock March 11, 2016 21:19 by author Administrator



Hibernate 5 : generator class=“sequence” not working

clock March 3, 2016 18:54 by author Administrator

after upgrade hibernate 4 to 5 sequence not working and hibernate get next val from hibernate_sequence  but 

I solved it by re-configuring mapping in the HBM file from:

<generator class="sequence">

           <param name="sequence">PRODUCT_ID_SEQ</param>

</generator>

to:

<generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">

          <param name="prefer_sequence_per_entity">true</param>

          <param name="optimizer">none</param>

          <param name="increment_size">1</param>

          <param name="sequence_name">PRODUCT_ID_SEQ</param>

</generator> 

ref:http://stackoverflow.com/questions/2155376/how-to-use-existing-oracle-sequence-to-generate-id-in-hibernate


Oracle Table Flash Back Query

clock March 2, 2016 21:31 by author Administrator

From Oracle Ver. 9i Oracle has introduced Flashback Query feature.  It is useful to recover from accidental statement failures. For example, suppose a user accidently deletes rows from a table and commits it also then, using flash back query he can get back the rows.

Flashback feature depends upon on how much undo retention time you have specified. If you have set the UNDO_RETENTION parameter to 2 hours then, Oracle will not overwrite the data in undo tablespace even after committing until 2 Hours have passed. Users can recover from their mistakes made since last 2 hours only.

For example, suppose John gives a delete statement at 10 AM and commits it. After 1 hour he realizes that delete statement is mistakenly performed. Now he can give a flashback  AS.. OF query to get back the deleted rows like this.

Flashback Query

SQL>select * from emp as of timestamp sysdate-1/24;

Or

SQL> SELECT * FROM emp AS OF TIMESTAMP 
      TO_TIMESTAMP('2007-06-07 10:00:00', 'YYYY-MM-DD HH:MI:SS')

 

CoolCool

Cool

Cool

Cool

Cool

 ref http://www.oracle-dba-online.com/flash_back_features.htm


What is difference between Abstract classes and interface in JAVA 8?

clock February 27, 2016 20:57 by author Administrator
  • Interesting to know that now with Java 8 is possible to use a method body of an interface.So in Java 8, the only difference between an interface or an abstract class depends if we want all the methods to be public or not? (Or to implement multiple interfaces in a class like said by Piotr )
  • ,jQuery15206033902112394571_1456594024402??


proxy(forward proxy) vs reverse proxy

clock November 5, 2015 18:31 by author Administrator

A reverse proxy is mostly a server-side concept, and is usually used in the context of CDNs (content distribution networks) for caching static HTTP content. A forward proxy is usually a client side concept used for anonymity, to subvert censorship, and (back in the days of dial-up) as a web accelerator.



apache poi excel cell type

clock November 5, 2015 13:46 by author Administrator

i have an excel file that have 2 cell that value of them have this 

cell 1 : azizkhani

cell 2:007596819379

format of cells is string (text)

but when i  read cell value in apache poi cell type in cell 2 is numeric

i want to read string value of them

for solve this prolem will write this line before reading cell value;

 

cell.setCellType(Cell.CELL_TYPE_STRING);

 

return cell.getStringCellValue();

 



how to set redis key time out (spring session timeout) maxInactiveInterval

clock October 6, 2015 20:22 by author Administrator

 

when using spring session in a container when http session is time out session or key that store in redis dose not time out for solve this problem and set timeout or that config like this code 


<beanclass="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"p:maxInactiveIntervalInSeconds="180"/>



docker save vs export

clock September 9, 2015 10:48 by author Administrator

Export

is used to persist a container (not an image).container in A running instance of an image is called container.

docker export <CONTAINER ID> > /home/export.tar

for example docker export nginx >/azizkhani/nginx.tar

 

Save

is used to persist an image (not a container). So we need the image name which


docker save nginx > /azizkhani/nginx.tar



create nginx image from Dockerfile

clock September 8, 2015 22:25 by author Administrator

i want to create nginx docker image that i can manage nginx.config

for solve this problem i do it

create nginx.config that have this content: in /azizkhani/nginx

events {

  worker_connections  1024;

}

http {

  upstream sessionApp {

    server localhost:8082;

    server localhost:8081;

  }

  server {

    listen 80;

    location / {

      proxy_pass http://sessionApp;

    }

  }

create DockerFile(without extension) : in  /azizkhani/nginx

 

 

 

 

 

 

FROM nginx

RUN mkdir -p /etc/nginx

COPY nginx.conf /etc/nginx/nginx.conf

and run this command in docker terminal after 

cd /azizkhani/nginx

docker build -t myNginxImage

and after create image 

run this command to create container from myNginxImage

$ docker run --name container-nginx-name -d -p8080:80 myNginxImage

request localhost and nginx show proxy(localhost:8081)


 


change default tomcat port in maven tomcat using maven parameter

clock September 5, 2015 20:22 by author Administrator

i want to run one app in two port for test in spring-session and redis Cool :D

mvn tomcat:run -Dmaven.tomcat.port=8081



About the author

 Welcome to this web site . This page has two purposes: Sharing information about my professional life such as articles, presentations, etc.
This website is also a place where I would like to share content I enjoy with the rest of the world. Feel free to take a look around, read my blog


Java,J2EE,Spring Framework,JQuery,

Hibernate,NoSql,Cloud,SOA,Rest WebService and Web Stack tech...

RecentPosts

Month List

Sign In