NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.highradius.DOA;
import com.highradius.Modal.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class daoImplementation implements Daointerface
{
Configuration con=new Configuration().configure().addAnnotatedClass(movie.class);
SessionFactory sf=con.buildSessionFactory();
Session session=sf.openSession();
Map<String,Object> map=new HashMap<>();

public void add(String title,String date,String special,String rating,String lang,String diname,String descrip)
{

Transaction tx=session.beginTransaction();
movie obj=new movie();
// Object object=(Object)lang;
//languagepojo lang2=(languagepojo)object;
//String lang3=lang2.getName();
obj.setTitle(title);
obj.setRelease_year(date);
obj.setSpecial(special);
obj.setLanguage(lang);
//obj.setObj(lang2);
obj.setDirector(diname);
obj.setDescription(descrip);
obj.setRating(rating);
obj.setIsdeleted("1");
session.save(obj);
tx.commit();
}
public void delete(Integer film_id)
{
Transaction tx=session.beginTransaction();
String s="UPDATE movie SET isdeleted=0 WHERE film_id=:id";
Query q=session.createQuery(s);
q.setInteger("id",film_id);
q.executeUpdate();
tx.commit();
}
public void update(String title,String date,String special,String rating,String lang,String diname,String descrip,String film_id)
{
Transaction tx=session.beginTransaction();
String s="UPDATE movie SET title=:title,description=:description,release_year=:release_year,obj=:language,rating=:rating,special=:special,director=:diname WHERE film_id=:id";
Query q=session.createQuery(s);
q.setString("title", title);
q.setString("description",descrip);
q.setString("release_year",date);
q.setString("language", lang);
q.setString("rating", rating);
q.setString("special", special);
q.setString("diname", diname);
q.setInteger("id",Integer.parseInt(film_id));
q.executeUpdate();
tx.commit();
}
public Map<String,Object> display(Integer start,Integer limit,String movie,String director,String release_year,String language,Integer page)
{
ArrayList<pojo> array=new ArrayList<pojo>();
Transaction tx=session.beginTransaction();
String s="From movie as m inner join m.obj where isdeleted=1 AND title LIKE '"+movie+"%' AND release_year LIKE '"+release_year+"%' AND director LIKE '"+director+"%' AND m.obj.language_id LIKE '"+language+"%' ORDER BY film_id";
Query q=session.createQuery(s);
q.setFirstResult(start);
q.setMaxResults(limit);
tx.commit();
List list=q.list();
for(Iterator it=list.iterator();it.hasNext();)
{
pojo obj=new pojo();
Object[] obj1=(Object[])it.next();
movie obj2=(movie)obj1[0];
languagepojo obj3=(languagepojo)obj2.getObj();
System.out.println(obj1);
obj.setFilm_id(obj2.getFilm_id());
obj.setTitle(obj2.getTitle());
obj.setDescription(obj2.getDescription());
obj.setRelease_year(obj2.getRelease_year());
obj.setLanguage(obj3.getName());
obj.setDiname(obj2.getDirector());
obj.setRating(obj2.getRating());
obj.setSpecial(obj2.getSpecial());
array.add(obj);
}
tx=session.beginTransaction();
String s1="Select Count(*) from movie as m inner join m.obj where isdeleted=1 AND title LIKE '"+movie+"%' AND release_year LIKE '"+release_year+"%' AND director LIKE '"+director+"%' AND m.obj.language_id LIKE '"+language+"%' ORDER BY film_id";
Query q1=session.createQuery(s1);
tx.commit();
List list2=q1.list();
Iterator it=list2.iterator();
long k=(long)it.next();
map.put("root", array);
map.put("total", k);
return map;
}
}


     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.