ORM/Hibernate. Hibernate - это один из самых популярных на сегодняшний день ORM-фреймворков.

Size: px
Start display at page:

Download "ORM/Hibernate. Hibernate - это один из самых популярных на сегодняшний день ORM-фреймворков."

Transcription

1 Hibernate

2 ORM/Hibernate ORM(Object/Relational Mapping) - это способ сохранения объектов в реляционную базу данных. Другими словами ORM освобождает нас от работы с SQL и позволяет сосредоточиться на ООП. Hibernate - это один из самых популярных на сегодняшний день ORM-фреймворков.

3 Простая таблица CREATE TABLE Student ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, age INT NOT NULL );

4 Student entity public class Student { private Long id; private String name; private @GenericGenerator(name="increment", strategy = public Long getid() { return id;

5 Student entity - public String getname(){ return public Long getage(){ return age; public void setid(long i){ id = i; public void setname(string s){name = s; public void setage(long l){ age = l;

6 hibernate.cfg.xml <hibernate-configuration> <session-factory> <property name="connection.driver_class">com.mysql.jdbc.driver</property> <property name="connection.url">jdbc:mysql://localhost:3305/social</property> <property name="connection.username">root</property> <property name="connection.password">123456</property> <property name="connection.pool_size">10</property> <property name="dialect">org.hibernate.dialect.mysqldialect</property> <property name="show_sql">true</property> <property name="hbm2ddl.auto">update</property> <property name="hibernate.connection.autocommit">false</property> <mapping class="edu.entity.student" /> </session-factory> </hibernate-configuration>

7 HibernateUtil public class HibernateUtil { private static SessionFactory sessionfactory = null; static { try { //creates the session factory from hibernate.cfg.xml sessionfactory = new AnnotationConfiguration().configure().buildSessionFactory(); catch (Exception e) { e.printstacktrace(); public static SessionFactory getsessionfactory() { return sessionfactory;

8 DAO interface public interface StudentDao { public void addstudent(student student) throws SQLException; public void updatestudent(student student) throws SQLException; public Student getstudentbyid(long id) throws SQLException; public List getallstudents() throws SQLException; public void deletestudent(student student) throws SQLException;

9 StudentDaoImpl - 1 public class StudentDaoImpl implements StudentDao { public void addstudent(student stud) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.begintransaction(); session.save(stud); //update session.gettransaction().commit(); catch (Exception e) { finally { if (session!= null && session.isopen()) {session.close();

10 StudentDaoImpl - 2 public List<Student> getallstudents() throws SQLException { Session session = null; List<Student> studs = new ArrayList<Student>(); try { session = HibernateUtil.getSessionFactory().openSession(); studs = session.createcriteria(student.class).list(); catch (Exception e) { finally { if (session!= null && session.isopen()) { session.close(); return studs;

11 StudentDaoImpl - 3 public void deletestudent(student stud) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.begintransaction(); session.delete(stud); session.gettransaction().commit(); catch (Exception e) { finally { if (session!= null && session.isopen()) { session.close();

12 StudentDaoImpl - 4 public class Main { public static void main(string[] args) throws SQLException { StudentDao studentdao = new StudentDaoImpl(); Student s1 = new Student(); s1.setname("ivanov Ivan"); s1.setage(21l); studentdao.addstudent(s1); List<Student> studs = studentdao.getallstudents(); for(int i = 0; i < studs.size(); i++) { System.out.println("Имя студента : " + studs.get(i).getname()); studentdao.deletestudent(s2);

13 Запросы Запросы возвращают набор данных из базы данных, удовлетворяющих заданному условию. Библиотека Hibernate предлагает три вида запросов к БД: 1) Criteria 2) SQL 3) HQL

14 Criteria Criteria crit = session.createcriteria(student.class); //критерий запроса crit.setmaxresults(50);//ограничиваем число результатов crit.add( Expression.like("name", "Ivanov%") ); crit.add( Expression.between("age", 18, 25) ) ; crit.add( Expression.in( "name", new String[] { "Ivanov Ivan ) ) List studs = crit.list();//помещаем результаты в список Expression.like указывает шаблон, где _ любой один символ, % любое количество символов Expression.isNull значение поля равно NULL. Expression.between age имя поля, 18 минимальное значение указанного поля, 25 его максимальное значение Expression.in указывает диапазон значений конкретного поля Expression.disjunction, Expression.or дизъюнкция (OR) объединяет в себе несколько других выражений оператором ИЛИ. Expression.eq определяет равенство поля какому-то значению.

15 Criteria sort/example Результаты также можно отсортировать: List studs = sess.createcriteria(student.class).add( Expression.like("name", "Iv%").addOrder( Order.asc("name") )//по возрастанию.addorder( Order.desc("age") )//по убыванию.list(); Также есть возможность запроса по данным экземпляра класса: Student s = new Student(); s.setname("ivanov Ivan"); s.setage(20l); List results = session.createcriteria(student.class).add( Example.create(s) ).list(); Example example = Example.create(s).excludeZeroes() //исключает поля с нулевыми значениями.excludeproperty("name") //исключает поле "name".ignorecase() //задает независимое от регистра сравнение строк.enablelike(); //использует like для сравнения строк List results = session.createcriteria(student.class).add(example).list();

16 SQL Query query = session.createsqlquery("select * from Student where name like?").addentity(student.class); List result = query.setstring(0, "Ivan%").list(); query = session.createsqlquery("select * from Student where name like :name").addentity(student.class); List result = query.setstring("name", "Ivan%").list();

17 HQL Hibernate позволяет производить запросы на HQL(The Hibernate Query Language Язык запросов Hibernate), который во многом похож на язык SQL, с той разницей, что является полностью объектно-ориентированным. List<Student> studs = (List<Student>)session.createQuery("from Student order by name").list();

18 name = "findstockbystockcode", query = "from Stock s where s.stockcode = :stockcode" name = "findstockbystockcodenativesql", query = "select * from stock s where s.stock_code = :stockcode", resultclass = Stock.class = "stock ) public class Stock implements java.io.serializable {

19 Named Query Query query = session.getnamedquery("findstockbystockcode").setstring("stockcode", "7277"); Query query = session.getnamedquery("findstockbystockcodenativesql").setstring("stockcode", "7277");

20 One-To-One

21 One-To-One = "STUDENT") public class Student { private Address = address_id") public Address getstudentaddress() { return this.studentaddress; public void setstudentaddress(address studentaddress) { this.studentaddress = studentaddress;

22 = "ADDRESS") public class Address {... = "studentaddress") private Student getstudent { return student;

23 One-To-One = "STUDENT") public class Student { private Address = = student_adress", joincolumns student_id"), inversejoincolumns address_id") ) public Address getstudentaddress() { return this.studentaddress;

24 One-To-Many/Many-To-Many = "STUDENT") public class Student { private Set<Address> = = student_adress", joincolumns student_id"), inversejoincolumns address_id") ) public Set<Address> getstudentaddress() { return this.studentaddress;

25 = false, name = = "long", metatype = "int", metavalues = = "1", targetentity = = "2", targetentity = = "parent_children", joincolumns = "parent_id", nullable = false), inversejoincolumns = "child_id", nullable = false)) protected Set<Child> getchildren() { return children;

26 Q&A

Unit 6 Hibernate. List the advantages of hibernate over JDBC

Unit 6 Hibernate. List the advantages of hibernate over JDBC Q1. What is Hibernate? List the advantages of hibernate over JDBC. Ans. Hibernate is used convert object data in JAVA to relational database tables. It is an open source Object-Relational Mapping (ORM)

More information

WEB SERVICES EXAMPLE 2

WEB SERVICES EXAMPLE 2 INTERNATIONAL UNIVERSITY HCMC PROGRAMMING METHODOLOGY NONG LAM UNIVERSITY Instructor: Dr. Le Thanh Sach FACULTY OF IT WEBSITE SPECIAL SUBJECT Student-id: Instructor: LeMITM04015 Nhat Tung Course: IT.503

More information

1 st Step. Prepare the class to be persistent:

1 st Step. Prepare the class to be persistent: 1 st Step Prepare the class to be persistent: Add a surrogate id field, usually int, long, Integer, Long. Encapsulate fields (properties) using exclusively getter and setter methods. Make the setter of

More information

Chapter 7. The Annotations Alternative

Chapter 7. The Annotations Alternative Chapter 7. The Annotations Alternative Hibernate Annotations 1 / 33 Hibernate Annotations Java Annotation is a way to add information about a piece of code (typically a class, field, or method to help

More information

Chapter 3. Harnessing Hibernate

Chapter 3. Harnessing Hibernate Chapter 3. Harnessing Hibernate hibernate.cfg.xml session.save() session.createquery( from Track as track ) session.getnamedquery( tracksnolongerthan ); 1 / 20 Configuring Hibernate using XML (hibernate.cfg.xml)...

More information

Step By Step Guideline for Building & Running HelloWorld Hibernate Application

Step By Step Guideline for Building & Running HelloWorld Hibernate Application Step By Step Guideline for Building & Running HelloWorld Hibernate Application 1 What we are going to build A simple Hibernate application persisting Person objects The database table, person, has the

More information

G l a r i m y TeachCode Series. Hibernate. Illustrated. Krishna Mohan Koyya

G l a r i m y TeachCode Series. Hibernate. Illustrated. Krishna Mohan Koyya G l a r i m y TeachCode Series Hibernate Illustrated Krishna Mohan Koyya Basic Mapping Entities with XML Person.java import java.util.date; public class Person { private int id; private String name; private

More information

Advanced Web Systems 9- Hibernate annotations, Spring integration, Aspect Oriented Programming. A. Venturini

Advanced Web Systems 9- Hibernate annotations, Spring integration, Aspect Oriented Programming. A. Venturini Advanced Web Systems 9- Hibernate annotations, Spring integration, Aspect Oriented Programming A. Venturini Contents Hibernate Core Classes Hibernate and Annotations Data Access Layer with Spring Aspect

More information

What data persistence means? We manipulate data (represented as object state) that need to be stored

What data persistence means? We manipulate data (represented as object state) that need to be stored 1 Data Persistence What data persistence means? We manipulate data (represented as object state) that need to be stored persistently to survive a single run of the application queriably to be able to retrieve/access

More information

Java Persistence API (JPA)

Java Persistence API (JPA) Java Persistence API (JPA) Petr Křemen petr.kremen@fel.cvut.cz Winter Term 2016 Petr Křemen (petr.kremen@fel.cvut.cz) Java Persistence API (JPA) Winter Term 2016 1 / 53 Contents 1 Data Persistence 2 From

More information

HIBERNATE MOCK TEST HIBERNATE MOCK TEST I

HIBERNATE MOCK TEST HIBERNATE MOCK TEST I http://www.tutorialspoint.com HIBERNATE MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Hibernate Framework. You can download these sample mock tests

More information

SPRING DECLARATIVE TRANSACTION MANAGEMENT

SPRING DECLARATIVE TRANSACTION MANAGEMENT SPRING DECLARATIVE TRANSACTION MANAGEMENT http://www.tutorialspoint.com/spring/declarative_management.htm Copyright tutorialspoint.com Declarative transaction management approach allows you to manage the

More information

Introduction to Session beans. EJB - continued

Introduction to Session beans. EJB - continued Introduction to Session beans EJB - continued Local Interface /** * This is the HelloBean local interface. * * This interface is what local clients operate * on when they interact with EJB local objects.

More information

Installing MySQL. Hibernate: Setup, Use, and Mapping file. Setup Hibernate in IDE. Starting WAMP server. phpmyadmin web console

Installing MySQL. Hibernate: Setup, Use, and Mapping file. Setup Hibernate in IDE. Starting WAMP server. phpmyadmin web console Installing MySQL Hibernate: Setup, Use, and Mapping file B.Tech. (IT), Sem-6, Applied Design Patterns and Application Frameworks (ADPAF) Dharmsinh Desai University Prof. H B Prajapati Way 1 Install from

More information

Chapter 4. Collections and Associations

Chapter 4. Collections and Associations Chapter 4. Collections and Associations Collections Associations 1 / 51 Java Variable and Collection class Person { Address address; class Address { Set persons = new HashSet; 2 / 51 Java

More information

Tiers (or layers) Separation of concerns

Tiers (or layers) Separation of concerns Tiers (or layers) Separation of concerns Hiding the type of storage from the client class Let s say we have a program that needs to fetch objects from a storage. Should the program have to be concerned

More information

2018/2/5 话费券企业客户接入文档 语雀

2018/2/5 话费券企业客户接入文档 语雀 1 2 2 1 2 1 1 138999999999 2 1 2 https:lark.alipay.com/kaidi.hwf/hsz6gg/ppesyh#2.4-%e4%bc%81%e4%b8%9a%e5%ae%a2%e6%88%b7%e6%8e%a5%e6%94%b6%e5%85%85%e5 1/8 2 1 3 static IAcsClient client = null; public static

More information

CSE 530A. Lab 3. Washington University Fall 2013

CSE 530A. Lab 3. Washington University Fall 2013 CSE 530A Lab 3 Washington University Fall 2013 Table Definitions The table definitions for lab 3 are slightly different from those for lab 2 Serial ID columns have been added to all of the tables Lab 2:

More information

Get Back in Control of your SQL

Get Back in Control of your SQL Get Back in Control of your SQL SQL and Java could work together so much better if we only let them. About my motivation SQL dominates database systems SQL seems «low level» and «dusty» SQL can do so much

More information

Exploring EJB3 With JBoss Application Server Part 6.3

Exploring EJB3 With JBoss Application Server Part 6.3 By Swaminathan Bhaskar 02/07/2009 Exploring EJB3 With JBoss Application Server Part 6.3 In this part, we will continue to explore Entity Beans Using Java Persistence API (JPA). In the previous part, we

More information

Hibernate Overview. By Khader Shaik

Hibernate Overview. By Khader Shaik Hibernate Overview By Khader Shaik 1 Agenda Introduction to ORM Overview of Hibernate Why Hibernate Anatomy of Example Overview of HQL Architecture Overview Comparison with ibatis and JPA 2 Introduction

More information

HIBERNATE MOCK TEST HIBERNATE MOCK TEST IV

HIBERNATE MOCK TEST HIBERNATE MOCK TEST IV http://www.tutorialspoint.com HIBERNATE MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Hibernate Framework. You can download these sample mock tests

More information

Java Object/Relational Persistence with Hibernate. David Lucek 11 Jan 2005

Java Object/Relational Persistence with Hibernate. David Lucek 11 Jan 2005 Java Object/Relational Persistence with Hibernate David Lucek 11 Jan 2005 Object Relational Persistence Maps objects in your Model to a datastore, normally a relational database. Why? EJB Container Managed

More information

LoadDataToDataGrid();

LoadDataToDataGrid(); Архангельский Алексей /// Загрузка данных в таблицу на форме в зависимости от того, что выбрано в комбобоксе private void LoadDataToDataGrid() button_add.isenabled = false; datagrid_booksorreaders.itemssource

More information

HIBERNATE - COMPONENT MAPPINGS

HIBERNATE - COMPONENT MAPPINGS HIBERNATE - COMPONENT MAPPINGS http://www.tutorialspoint.com/hibernate/hibernate_component_mappings.htm Copyright tutorialspoint.com A Component mapping is a mapping for a class having a reference to another

More information

HIBERNATE - MANY-TO-ONE MAPPINGS

HIBERNATE - MANY-TO-ONE MAPPINGS HIBERNATE - MANY-TO-ONE MAPPINGS http://www.tutorialspoint.com/hibernate/hibernate_many_to_one_mapping.htm Copyright tutorialspoint.com A many-to-one association is the most common kind of association

More information

Module 8 The Java Persistence API

Module 8 The Java Persistence API Module 8 The Java Persistence API Objectives Describe the role of the Java Persistence API (JPA) in a Java EE application Describe the basics of Object Relational Mapping Describe the elements and environment

More information

COMP 430 Intro. to Database Systems. SQL from application code

COMP 430 Intro. to Database Systems. SQL from application code COMP 430 Intro. to Database Systems SQL from application code Some issues How to connect to database Where, what type, user credentials, How to send SQL commands How to get communicate data to/from DB

More information

HIBERNATE - INTERCEPTORS

HIBERNATE - INTERCEPTORS HIBERNATE - INTERCEPTORS http://www.tutorialspoint.com/hibernate/hibernate_interceptors.htm Copyright tutorialspoint.com As you have learnt that in Hibernate, an object will be created and persisted. Once

More information

Oracle Object-Relational Features. Пыхалов А.В. ЮГИНФО

Oracle Object-Relational Features. Пыхалов А.В. ЮГИНФО Oracle Object-Relational Features Пыхалов А.В. ЮГИНФО Две грубейшие ошибки ORсистем Под классом объектов понимаем тип данных, имеющий поля и методы Две ошибки OR систем Класс объекта == Отношение Работа

More information

International Journal of Advance Research in Engineering, Science & Technology HIBERNATE FRAMEWORK FOR ENTERPRISE APPLICATION

International Journal of Advance Research in Engineering, Science & Technology HIBERNATE FRAMEWORK FOR ENTERPRISE APPLICATION Impact Factor (SJIF): 3.632 International Journal of Advance Research in Engineering, Science & Technology e-issn: 2393-9877, p-issn: 2394-2444 Volume 4, Issue 3, March-2017 HIBERNATE FRAMEWORK FOR ENTERPRISE

More information

Tutorial 6 CSC 201. Java Programming Concepts مبادئ الربجمة باستخدام اجلافا

Tutorial 6 CSC 201. Java Programming Concepts مبادئ الربجمة باستخدام اجلافا Tutorial 6 CSC 201 Java Programming Concepts مبادئ الربجمة باستخدام اجلافا Chapter 6: Classes and Objects 1. Classes & Objects What is an object? Real Objects Java Objects Classes Defining a class and

More information

Exploring EJB3 With JBoss Application Server Part 6.2

Exploring EJB3 With JBoss Application Server Part 6.2 By Swaminathan Bhaskar 01/24/2009 Exploring EJB3 With JBoss Application Server Part 6.2 In this part, we will continue to explore Entity Beans Using Java Persistence API (JPA). Thus far, we have seen examples

More information

SDN Community Contribution

SDN Community Contribution SDN Community Contribution (This is not an official SAP document.) Disclaimer & Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces

More information

HIBERNATE - ONE-TO-ONE MAPPINGS

HIBERNATE - ONE-TO-ONE MAPPINGS HIBERNATE - ONE-TO-ONE MAPPINGS http://www.tutorialspoint.com/hibernate/hibernate_one_to_one_mapping.htm Copyright tutorialspoint.com A one-to-one association is similar to many-to-one association with

More information

EXAMINATION FOR THE DIPLOMA IN INFORMATION TECHNOLOGY; YEAR 2

EXAMINATION FOR THE DIPLOMA IN INFORMATION TECHNOLOGY; YEAR 2 FACULTY OF SCIENCE AND TECHNOLOGY EXAMINATION FOR THE DIPLOMA IN INFORMATION TECHNOLOGY; YEAR 2 SAMPLE QUESTION Question 1 A class called TV is required by a programmer who is writing software for a retail

More information

Hibernate in close action. INF5750/ Lecture 3 (Part III)

Hibernate in close action. INF5750/ Lecture 3 (Part III) Hibernate in close action INF5750/9750 - Lecture 3 (Part III) Recalling Hibernate from Lect 2 Hibernate is an ORM tool? Hibernate can communication with different DBMS through? (mentioned in hibernate.properties)

More information

Максим Грамин КРОК. В поисках идеального инструмента

Максим Грамин КРОК. В поисках идеального инструмента Максим Грамин КРОК В поисках идеального инструмента Disclaimer Личное мнение на личном опыте Немного о себе Немного о себе Немного о себе Немного о себе Немного о себе Одинаковые проблемы Версионность

More information

ОБЪЕКТНО- ОРИЕНТИРОВАННОЕ ПРОГРАММИРОВАНИЕ. Лекция 1 / г.

ОБЪЕКТНО- ОРИЕНТИРОВАННОЕ ПРОГРАММИРОВАНИЕ. Лекция 1 / г. ОБЪЕКТНО- ОРИЕНТИРОВАННОЕ ПРОГРАММИРОВАНИЕ Лекция 1 / 04 04.03.2019 г. VIRTUAL DESTRUCTOR class Shape{ int x, y; Shape(int x, int y); ~Shape(){ printf("dtor shape!\n"); class Circle: public Shape{ int

More information

Основы Java для разработки приложений для Android. Версия 7 AND-404

Основы Java для разработки приложений для Android. Версия 7 AND-404 Основы Java для разработки приложений для Android. Версия 7 AND-404 ДЕТАЛЬНАЯ ИНФОРМАЦИЯ О КУРСЕ Основы Java для разработки приложений для Android. Версия 7 Код курса: AND-404 Длительность 2 дня / 12 академических

More information

Instance Method Development Demo

Instance Method Development Demo Instance Method Development Demo Write a class Person with a constructor that accepts a name and an age as its argument. These values should be stored in the private attributes name and age. Then, write

More information

What is Transaction? Why Transaction Management Required? JDBC Transaction Management in Java with Example. JDBC Transaction Management Example

What is Transaction? Why Transaction Management Required? JDBC Transaction Management in Java with Example. JDBC Transaction Management Example JDBC Transaction Management in Java with Example Here you will learn to implement JDBC transaction management in java. By default database is in auto commit mode. That means for any insert, update or delete

More information

So, this tutorial is divided into various chapters for the simple presentation and easy understanding.

So, this tutorial is divided into various chapters for the simple presentation and easy understanding. MYBATIS 1 About the Tutorial MYBATIS is a persistence framework that automates the mapping among SQL databases and objects in Java,.NET, and Ruby on Rails. MYBATIS makes it easier to build better database

More information

Oracle Exam 1z0-809 Java SE 8 Programmer II Version: 6.0 [ Total Questions: 128 ]

Oracle Exam 1z0-809 Java SE 8 Programmer II Version: 6.0 [ Total Questions: 128 ] s@lm@n Oracle Exam 1z0-809 Java SE 8 Programmer II Version: 6.0 [ Total Questions: 128 ] Oracle 1z0-809 : Practice Test Question No : 1 Given: public final class IceCream { public void prepare() { public

More information

Setting Schema Name For Native Queries In. Hibernate >>>CLICK HERE<<<

Setting Schema Name For Native Queries In. Hibernate >>>CLICK HERE<<< Setting Schema Name For Native Queries In Hibernate Executing a Oracle native query with container managed datasource By default in Oracle I need to specify the schema in the table name to make a query,

More information

Create a simple database with MySQL

Create a simple database with MySQL Create a simple database with MySQL 1.Connect the MySQL server through MySQL Workbench You can achieve many database operations by typing the SQL langue into the Query panel, such as creating a database,

More information

The Object-Oriented Paradigm. Employee Application Object. The Reality of DBMS. Employee Database Table. From Database to Application.

The Object-Oriented Paradigm. Employee Application Object. The Reality of DBMS. Employee Database Table. From Database to Application. The Object-Oriented Paradigm CS422 Principles of Database Systems Object-Relational Mapping (ORM) Chengyu Sun California State University, Los Angeles The world consists of objects So we use object-oriented

More information

Voyager Database Developer s Guide Version 1.0 for Voyager 8.0

Voyager Database Developer s Guide Version 1.0 for Voyager 8.0 Voyager Database Developer s Guide Version 1.0 for Voyager 8.0 Table of Contents Introduction... 4 Overview... 4 Preface... 4 Database Requirements... 4 Contacting Technical Support... 4 Voyager JDBC API

More information

Technical basis. Interfaces. Framework and tool overview

Technical basis. Interfaces. Framework and tool overview Introduction - INF 5750 INF 5750 Technical basis Interfaces Three-layer architecture Framework and tool overview Interfaces What is it? Defines a contract with implementing classes Defines which h methods

More information

GET BACK IN CONTROL OF YOUR SQL. Lukas Eder

GET BACK IN CONTROL OF YOUR SQL. Lukas Eder GET BACK IN CONTROL OF YOUR SQL Lukas Eder SQL and Java / Scala could work together so much better if we only let them. Our vision at Data Geekery - SQL dominates database systems - SQL is very expressive

More information

Developing Java EE 5 Applications from Scratch

Developing Java EE 5 Applications from Scratch Developing Java EE 5 Applications from Scratch Copyright Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without

More information

Generating A Hibernate Mapping File And Java Classes From The Sql Schema

Generating A Hibernate Mapping File And Java Classes From The Sql Schema Generating A Hibernate Mapping File And Java Classes From The Sql Schema Internally, hibernate maps from Java classes to database tables (and from It also provides data query and retrieval facilities by

More information

Консультант в Miles. Работаю с F# и Демо презентации: https://github.com/object/ AkkaStreamsDemo

Консультант в Miles. Работаю с F# и Демо презентации: https://github.com/object/ AkkaStreamsDemo Консультант в Miles Работаю с F# и C# @ooobject vagif.abilov@mail.com Демо презентации: https://github.com/object/ AkkaStreamsDemo У вас уже может быть опыт работы с...для понимания этого доклада он необязателен!

More information

АВТОМАТИЧЕСКАЯ СЕГМЕНТАЦИЯ ЗАПРОСОВ ПОЛЬЗОВАТЕЛЕЙ С ПОМОЩЬЮ ЖУРНАЛОВ ЩЕЛЧКОВ И СЛОВАРЕЙ

АВТОМАТИЧЕСКАЯ СЕГМЕНТАЦИЯ ЗАПРОСОВ ПОЛЬЗОВАТЕЛЕЙ С ПОМОЩЬЮ ЖУРНАЛОВ ЩЕЛЧКОВ И СЛОВАРЕЙ УДК 002.53; 002.53:004.65; 002.53:004.62/.63 АВТОМАТИЧЕСКАЯ СЕГМЕНТАЦИЯ ЗАПРОСОВ ПОЛЬЗОВАТЕЛЕЙ С ПОМОЩЬЮ ЖУРНАЛОВ ЩЕЛЧКОВ И СЛОВАРЕЙ Ю. Е. Киселёва Санкт-Петербургский государственный университет Поступила

More information

Basics of programming 3. Java Enterprise Edition

Basics of programming 3. Java Enterprise Edition Basics of programming 3 Java Enterprise Edition Introduction Basics of programming 3 BME IIT, Goldschmidt Balázs 2 Enterprise environment Special characteristics continuous availability component based

More information

HIBERNATE - SORTEDSET MAPPINGS

HIBERNATE - SORTEDSET MAPPINGS HIBERNATE - SORTEDSET MAPPINGS http://www.tutorialspoint.com/hibernate/hibernate_sortedset_mapping.htm Copyright tutorialspoint.com A SortedSet is a java collection that does not contain any duplicate

More information

Math-Net.Ru All Russian mathematical portal

Math-Net.Ru All Russian mathematical portal Math-Net.Ru All Russian mathematical portal Sergey Ivanov, Anna Kalenkova, Comparing process models in the BPMN 2.0 XML format, Proceedings of ISP RAS, 2015, Volume 27, Issue 3, 255 266 DOI: https://doi.org/10.15514/ispras-2015-27(3)-17

More information

Schema Null Cannot Be Resolved For Table Jpa

Schema Null Cannot Be Resolved For Table Jpa Schema Null Cannot Be Resolved For Table Jpa (14, 19) The abstract schema type 'Movie' is unknown. (28, 35) The state field path 'm.title' cannot be resolved to a valid type. at org.springframework.web.servlet.

More information

Reversible Data Hiding Using a Histogram Modification

Reversible Data Hiding Using a Histogram Modification БЪЛГАРСКА АКАДЕМИЯ НА НАУКИТЕ BULGARIAN ACADEMY OF SCIENCES ПРОБЛЕМИ НА ТЕХНИЧЕСКАТА КИБЕРНЕТИКА И РОБОТИКАТА, 66 PROBLEMS OF ENGINEERING CYBERNETICS AND ROBOTICS, 66 София 2015 Sofia Reversible Data Hiding

More information

ORM and JPA 2.0. Zdeněk Kouba, Petr Křemen

ORM and JPA 2.0. Zdeněk Kouba, Petr Křemen ORM and JPA 2.0 Zdeněk Kouba, Petr Křemen Compound primary keys Id Class public class EmployeeId implements Serializable { private String country; private int id; @IdClass(EmployeeId.class) public class

More information

Name:... ID:... class A { public A() { System.out.println( "The default constructor of A is invoked"); } }

Name:... ID:... class A { public A() { System.out.println( The default constructor of A is invoked); } } KSU/CCIS/CS CSC 113 Final exam - Fall 12-13 Time allowed: 3:00 Name:... ID:... EXECRICE 1 (15 marks) 1.1 Write the output of the following program. Output (6 Marks): class A public A() System.out.println(

More information

Painless Persistence. Some guidelines for creating persistent Java applications that work

Painless Persistence. Some guidelines for creating persistent Java applications that work Painless Persistence Some guidelines for creating persistent Java applications that work The Authors Anthony Patricio Senior JBoss Certification Developer Highest volume poster on early Hibernate forums

More information

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige CSC 308 2.0 System Development with Java Database Connection Budditha Hettige Department of Statistics and Computer Science Budditha Hettige 1 From database to Java There are many brands of database: Microsoft

More information

CSE 530A. DAOs and MVC. Washington University Fall 2012

CSE 530A. DAOs and MVC. Washington University Fall 2012 CSE 530A DAOs and MVC Washington University Fall 2012 Model Object Example public class User { private Long id; private String username; private String password; public Long getid() { return id; public

More information

Introduction INF 5750

Introduction INF 5750 Introduction - INF 5750 INF 5750 Technical basis Interfaces Three-layer architecture Framework and tool overview Interfaces What is it? Defines a contract with implementing classes Defines which methods

More information

Tutorial Hibernate Annotaion Simple Book Library

Tutorial Hibernate Annotaion Simple Book Library Tutorial Hibernate Annotaion Simple Book Library 1. Create Java Project. 2. Add Hibernate Library. 3. Source Folder, create hibernate configuration file (hibernate.cfg.xml). Done. 4. Source Folder, create

More information

Hibernate Interview Questions

Hibernate Interview Questions Hibernate Interview Questions 1. What is Hibernate? Hibernate is a powerful, high performance object/relational persistence and query service. This lets the users to develop persistent classes following

More information

Getting Started with the Bullhorn SOAP API and Java

Getting Started with the Bullhorn SOAP API and Java Getting Started with the Bullhorn SOAP API and Java Introduction This article is targeted at developers who want to do custom development using the Bullhorn SOAP API and Java. You will create a sample

More information

Chapter 9. A Look at HQL

Chapter 9. A Look at HQL Chapter 9. A Look at HQL Writing HQL Queries Working with Aggregate Values Writing Native SQL Queries 1 / 18 Writing HQL Queries Minimal Valid HQL Queries from Example 9-1. The simplest HQL

More information

Spring & Hibernate. Knowledge of database. And basic Knowledge of web application development. Module 1: Spring Basics

Spring & Hibernate. Knowledge of database. And basic Knowledge of web application development. Module 1: Spring Basics Spring & Hibernate Overview: The spring framework is an application framework that provides a lightweight container that supports the creation of simple-to-complex components in a non-invasive fashion.

More information

= "categories") 1 public class Category implements java.io.serializable { 2 private static final long serialversionuid = 1L;

= categories) 1 public class Category implements java.io.serializable { 2 private static final long serialversionuid = 1L; @Entity @Table(name = "categories") 1 public class Category implements java.io.serializable { 2 private static final long serialversionuid = 1L; @Id @GeneratedValue 3 private Long id; 4 private String

More information

Dynamic DAO Implementation

Dynamic DAO Implementation Dynamic DAO Implementation Example dynamic-dao-implementation can be browsed at https://github.com/apache/tomee/tree/master/examples/dynamic-daoimplementation Many aspects of Data Access Objects (DAOs)

More information

Tutorial 4. public class Stock { private int numberofshares; private double dividend; private String TickerSymbol;

Tutorial 4. public class Stock { private int numberofshares; private double dividend; private String TickerSymbol; Tutorial 4 1- Based on the following UML create the Stock class Stock - numberofshares:int - TickerSymbol:String - dividend:double +getnumberofshares():int +gettickersymbol():string +getdividend():double

More information

Index. setmaxresults() method, 169 sorting, 170 SQL DISTINCT query, 171 uniqueresult() method, 169

Index. setmaxresults() method, 169 sorting, 170 SQL DISTINCT query, 171 uniqueresult() method, 169 Index A Annotations Hibernate mappings, 81, 195 Hibernate-specific persistence annotations Immutable annotation, 109 natural ID, 110 Hibernate XML configuration file, 108 JPA 2 persistence (see JPA 2 persistence

More information

Подключение ультразвукового датчика HC-SR04

Подключение ультразвукового датчика HC-SR04 Подключение ультразвукового датчика HC-SR04 Датчик HC-SR-04 состоит из передатчика, приемника и схемы управления. Для наиболее оптимального режима поиска препятствий датчик устанавливается на сервомотор

More information

This tutorial will take you through simple and practical approaches while learning JDBC framework provided by Spring.

This tutorial will take you through simple and practical approaches while learning JDBC framework provided by Spring. About the Tutorial Spring JDBC Framework takes care of all the low-level details starting from opening the connection, preparing and executing the SQL statement, processing exceptions, handling transactions,

More information

Java 1996 AP Computer Science Question 3

Java 1996 AP Computer Science Question 3 Java 1996 AP Computer Science Question 3 http://www.cs.duke.edu/csed/ap/exams/1996/ab3.html 1 of 2 7/8/2003 5:07 PM Java 1996 AP Computer Science Question 3 Assume that binary trees are implemented using

More information

3D ray tracing simple scalability case study

3D ray tracing simple scalability case study 3D ray tracing simple scalability case study Threading in OpenMP*, Intel Threading Building Blocks and Intel Cilk Plus Based on Intel TBB tachyon package example Vladimir Polin Threading Runtimes Engineering

More information

Exception handling & logging Best Practices. Angelin

Exception handling & logging Best Practices. Angelin Exception handling & logging Best Practices Angelin AGENDA Logging using Log4j Logging Best Practices Exception Handling Best Practices CodePro Errors and Fixes Logging using Log4j Logging using Log4j

More information

Object-Relational Mapping is NOT serialization! You can perform queries on each field!

Object-Relational Mapping is NOT serialization! You can perform queries on each field! ORM Object-Relational Mapping is NOT serialization! You can perform queries on each field! Using hibernate stand-alone http://www.hibernatetutorial.com/ Introduction to Entities The Sun Java Data Objects

More information

Mappings and Queries. with. Hibernate

Mappings and Queries. with. Hibernate Mappings and Queries with Hibernate Mappings Collection mapping Mapping collection of values e.g. holidays, months Association mapping Mapping of relationships between two objects e.g. Account and AccountOwner

More information

Distributed Systems Recitation 1. Tamim Jabban

Distributed Systems Recitation 1. Tamim Jabban 15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Tuesday: 9:30-11:59 AM Thursday: 10:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming

More information

Карта «Кофейные регионы Эфиопии» Коллеги из Trabocca любезно предоставили нам карту кофейных регионов Эфиопии, за что

Карта «Кофейные регионы Эфиопии» Коллеги из Trabocca любезно предоставили нам карту кофейных регионов Эфиопии, за что 19 Февраля 2019 Карта «Кофейные регионы Эфиопии» Коллеги из Trabocca любезно предоставили нам карту кофейных регионов Эфиопии, за что большое им спасибо! Целью создания карты была ощутимая прослеживаемость

More information

Integration Of Struts2 And Hibernate Frameworks

Integration Of Struts2 And Hibernate Frameworks Integration Of Struts2 And Hibernate Frameworks Remya P V 1, Aswathi R S 1, Swetha M 1, Sijil Sasidharan 1, Sruthi E 1, Vipin Kumar N 1 1 (Department of MCA,NMAMIT Nitte/ Autonomous under VTU, India) ABSTRACT:

More information

жидкость и пневматика Rectus 86/87/88 Быстроразъемные соединения для термостатирования пресс-форм

жидкость и пневматика Rectus 86/87/88 Быстроразъемные соединения для термостатирования пресс-форм жидкость и пневматика Rectus 8//88 Быстроразъемные соединения для термостатирования пресс-форм 2ow Pressure Mould s INTERNTION 80% of actual size Chart Pressure rop (bar) Pressure rop (bar) Pressure rop

More information

TDDB84: Lecture 5. Singleton, Builder, Proxy, Mediator. fredag 27 september 13

TDDB84: Lecture 5. Singleton, Builder, Proxy, Mediator. fredag 27 september 13 TDDB84: Lecture 5 Singleton, Builder, Proxy, Mediator Creational Abstract Factory Singleton Builder Structural Composite Proxy Bridge Adapter Template method Behavioral Iterator Mediator Chain of responsibility

More information

Software Tools Data Access Layers

Software Tools Data Access Layers 2009 Software Tools Data Access Layers Part II - Lecture 3 1 The University of Auckland New Zealand COMPSCI 732 Today s Outline 2009 Data Access Layers PDStore Assignment 2 Project 2 The University of

More information

Юнит-тестирование Lua-кода при помощи TAP. Илья Чесноков

Юнит-тестирование Lua-кода при помощи TAP. Илья Чесноков Юнит-тестирование Lua-кода при помощи TAP Илья Чесноков Все началось...!2 С маленькой программки на Lua!3 ...несколько юнит-тестов...!4 lua-testmore!5 Test Anything Protocol (TAP)!6 Test Anything Protocol

More information

How does Metaprogramming affect software flexibility in Object-Relational Mapping

How does Metaprogramming affect software flexibility in Object-Relational Mapping How does Metaprogramming affect software flexibility in Object-Relational Mapping Abstract Metaprogramming is an important element in object-relational mapping. It is integrated, because we need to analyze

More information

MYBATIS - ANNOTATIONS

MYBATIS - ANNOTATIONS MYBATIS - ANNOTATIONS http://www.tutorialspoint.com/mybatis/mybatis_annotations.htm Copyright tutorialspoint.com In the previous chapters, we have seen how to perform curd operations using MyBatis. There

More information

IT 313 Advanced Application Development

IT 313 Advanced Application Development Page 1 of 10 IT 313 Advanced Application Development Final Exam -- March 13, 2016 Part A. Multiple Choice Questions. Answer all questions. You may supply a reason or show work for partial credit. 5 points

More information

Intelligent Data Layer: An approach to generating data layer from normalized database model.

Intelligent Data Layer: An approach to generating data layer from normalized database model. Degree project Intelligent Data Layer: An approach to generating data layer from normalized database model. Author: Amir Buzo Date: 2012-09-15 Subject: Computer Science Level: Master Course code: 4DV10E

More information

Getter and Setter Methods

Getter and Setter Methods Example 1 namespace ConsoleApplication14 public class Student public int ID; public string Name; public int Passmark = 50; class Program static void Main(string[] args) Student c1 = new Student(); Console.WriteLine("please..enter

More information

JPA and CDI JPA and EJB

JPA and CDI JPA and EJB JPA and CDI JPA and EJB Concepts: Connection Pool, Data Source, Persistence Unit Connection pool DB connection store: making a new connection is expensive, therefor some number of connections are being

More information

Chapter 13. Hibernate with Spring

Chapter 13. Hibernate with Spring Chapter 13. Hibernate with Spring What Is Spring? Writing a Data Access Object (DAO) Creating an Application Context Putting It All Together 1 / 24 What is Spring? The Spring Framework is an Inversion

More information

Object Oriented Programming

Object Oriented Programming Object Oriented Programming Debapriyo Majumdar Programming and Data Structure Lab M Tech CS I Semester I Indian Statistical Institute Kolkata August 7 and 14, 2014 Objects Real world objects, or even people!

More information

VanillaCore Walkthrough Part 1. Introduction to Database Systems DataLab CS, NTHU

VanillaCore Walkthrough Part 1. Introduction to Database Systems DataLab CS, NTHU VanillaCore Walkthrough Part 1 Introduction to Database Systems DataLab CS, NTHU 1 The Architecture VanillaDB JDBC/SP Interface (at Client Side) Remote.JDBC (Client/Server) Query Interface Remote.SP (Client/Server)

More information

SQL CSCI 201 Principles of Software Development

SQL CSCI 201 Principles of Software Development SQL CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. jeffrey.miller@usc.edu Outline SELECT Statements Try It USC CSCI 201L SELECT Statements SELECT statements are probably the most commonly

More information

Introduction to JPA. Fabio Falcinelli

Introduction to JPA. Fabio Falcinelli Introduction to JPA Fabio Falcinelli Me, myself and I Several years experience in active enterprise development I love to design and develop web and standalone applications using Python Java C JavaScript

More information

TypeScript. Часть II. Старков Дима

TypeScript. Часть II. Старков Дима TypeScript Часть II Старков Дима 1 Сегодня Вывод типов Структурная типизация Более сложные типы Обобщенные типы Type Guards 2 TypeScript? Спасет от выстрелов себе в ногу ESNext прямо сейчас Средство против

More information