Posts

How to display image in jsp saved in db using spring and hibernate

How to display image in jsp saved in db using spring and hibernate: I assume you know how to integrate spring with hibernate and how to write simple CRUD operation code using it please  Click here  for spring-hibernate integration example. In Jsp/html page -------------------------------------------------------------------------------------------------------------------------  <!DOCTYPE>  <html>  <head>  </head>  <body>  <img src=" getImagefromDB?personid=20 " width="400" height="400" alt="image">  </body>  </html> This getImagefromDB url must match in controller For example purpose I have taken persoonid as "20". In real-time project you must send this id dynamically as: <img src=" getImagefromDB?personid=${ pid } " width="400" height="400" alt="image"> In controller write the method to get that image from D...

How to retrieve a specific column from a table using hibernate lucene search

To retrieve a specific column from a table using hibernate lucene search we can use projections . Jars required are (same version or lower version) hibernate-core-5.2.7.Final hibernate-search-5.7.0.Final But before that we must store that column value using store=Store.yes @Indexed @Table @Entity Public class Employee{ @Field(store=Store.YES) private String name;  // other parameters //setter & getter methods } Note: without this fileld store=Store.yes we cant retrieve the values. This attribute will store values into index files created by lucene. In the program, wecan use projection to get all values from that column public class EmployeeDetails { @Autowired SessionFactory sessionFactory;            public List getEmployeeDetails {                    Session session = sessionFactory.openSession();     ...