Exploring EJB3 With JBoss Application Server Part 6.2

Size: px
Start display at page:

Download "Exploring EJB3 With JBoss Application Server Part 6.2"

Transcription

1 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 that explored various aspects of persisting a single entity using JPA. In the following paragraphs, we will be looking at the various types of entity relationships, namely, one-to-one, many-to-one, one-to-many, and many-to-many. Let us explore the one-to-one entity relationship. There could be two types of one-to-one relationships Unidirectional or Bidirectional. The relationship between any Customer and their Address is one-toone unidirectional relationship because a business usually looks up the Address given a Customer and not vice versa. The following diagram illustrates the relationship: Before we proceed with the example, we need to setup the two tables in the MySQL database testdb as follows: CREATE TABLE ADDRESS_TBL ( ADDR_ID INTEGER AUTO_INCREMENT, ADDRESS VARCHAR(50) NOT NULL, ZIP VARCHAR(10) NOT NULL, PRIMARY KEY PK_ADDR_ID(ADDR_ID) ); CREATE TABLE CUSTOMER_TBL ( CUST_ID INTEGER AUTO_INCREMENT, NAME VARCHAR(50) NOT NULL, CUST_ADDR_ID INTEGER, PRIMARY KEY PK_CUST_ID(CUST_ID), CONSTRAINT CUST_ADDR_FK FOREIGN KEY (CUST_ADDR_ID) REFERENCES ADDRESS_TBL(ADDR_ID) ); The following code shows the Address Entity Bean: Name: Bhaskar S

2 package custaddr.common; public class Address implements java.io.serializable { private static final long serialversionuid = private int id; private String address; private String zip; public int getid() { return id; public void setid(int id) { this.id = id; public String getaddress() { return address; public void setaddress(string arg) { address = arg; public String getzip() { return zip; public void setzip(string arg) { zip = arg; The Address entity uses auto generated primary key column (ADDR_ID). The following code shows the Customer Entity Bean: Name: Bhaskar S package custaddr.common; public class Customer implements java.io.serializable { private static final long serialversionuid = private int id; private String name;

3 private Address address; public int getid() { return id; public void setid(int id) { this.id = id; public String getname() { return name; public void setname(string n) { name = n; public Address getaddress() { return address; public void setaddress(address arg) { address = arg; The Customer entity is more interesting than the Address entity. The Customer entity uses auto generated primary key column (CUST_ID). annotation indicates that the Customer entity is related to the Address entity via the join column CUST_ADDR_ID. If we look at the table CUSTOMER_TBL we see that the column CUST_ADDR_ID references the column ADDR_ID on the table ADDRESS_TBL as a foreign key. annotation captures this relationship and indicates the join column. annotation indicates the one-to-one relationship between the Customer and the Address entity. The cascade attribute indicates that any data operation performed on the Customer entity also needs to be performed on the related Address entity. We will see the impact of this attribute in a following paragraphs when we look at the CustAddrBean Stateless Session Bean. The following code shows the Remote interface for CustAddr: Name: Bhaskar S package custaddr.remote; import javax.ejb.remote; import public interface CustAddr { public Customer getcustomer(int id); public void addcustomeraddress(string name, String address, String zip);

4 The CustAddr interface allows us to add a new Customer and its related Address or lookup an existing Customer and its related Address. The following shows the code for CustAddrBean stateless session bean: Name: Bhaskar S package custaddr.ejb; import custaddr.common.customer; import custaddr.common.address; import custaddr.remote.custaddr; import javax.ejb.stateless; import javax.persistence.entitymanager; import public class CustAddrBean implements CustAddr private EntityManager public Customer getcustomer(int id) { Customer cust = null; cust = _emgr.find(customer.class, id); if (cust!= null) { System.out.println("-> Customer<Query>: Id = " + cust.getid() + ", Name = " + cust.getname() + ", Address = " + cust.getaddress().getaddress()); return public void addcustomeraddress(string name, String address, String zip) { Address addr = new Address(); addr.setaddress(address); addr.setzip(zip); Customer cust = new Customer(); cust.setname(name); cust.setaddress(addr); // _emgr.persist(addr); // Need this if Customer does not use (cascade={cascadetype.all) _emgr.persist(cust); System.out.println("-> Customer<Insert>: Id = " + cust.getid() + ", Name = " + name); If we do not use the cascade attribute with annotation, then we will have to explicitly persist the Address entity before persisting the Customer entity. See the highlighted comment line. Failing to do so will cause the following exception: Caused by: java.lang.illegalstateexception: org.hibernate.transientobjectexception: object references an unsaved transient instance - save the transient instance before flushing: custaddr.common.customer.address -> custaddr.common.address By using the cascade attribute with annotation, persisting the Customer implicitly persists the related Address entity.

5 The following shows the code for a standalone client that is accessing the CustAddrBean stateless session bean through the remote interface CustAddr: Name: Bhaskar S package custaddr.client; import custaddr.remote.custaddr; import custaddr.common.address; import custaddr.common.customer; import java.io.bufferedreader; import java.io.inputstreamreader; import javax.naming.context; import javax.naming.initialcontext; public class CustAddrClient { public static void main(string[] args) { try { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); Context ctx = new InitialContext(); CustAddr custaddr = (CustAddr) ctx.lookup("custaddr/remote"); boolean exit = false; while (! exit) { System.out.println("1. Get Customer Information"); System.out.println("2. New Customer Information"); System.out.println("3. Quit"); String choice = input.readline(); if (choice.equals("1")) { System.out.print("Id: "); String idstr = input.readline(); Customer cust = custaddr.getcustomer(integer.parseint(idstr)); if (cust!= null) { Address addr = cust.getaddress(); System.out.println("-> Customer: Name = " + cust.getname() + ", Address = " + addr.getaddress()); else { System.out.println("No Customer information for " + idstr); else if (choice.equals("2")) { System.out.print("Name: "); String name = input.readline(); System.out.print("Address: "); String address = input.readline(); System.out.print("Zip: "); String zip = input.readline(); custaddr.addcustomeraddress(name, address, zip); System.out.println("Persisted Customer information for " + name); else if (choice.equals("3")) { exit = true; catch (Throwable ex) { ex.printstacktrace(system.err);

6 Next, we will compile and deploy the EJB jar my_ejb_beans.jar into the JBoss Application Server. Now, open a Terminal window and execute the script CustAddrClient.sh as illustrated below: $./CustAddrClient.sh 1. Get Customer Information 2. New Customer Information 3. Quit 2 Name: Swaminathan Bhaskar Address: 100 North Pole Zip: Persisted Customer information for Swaminathan Bhaskar 1. Get Customer Information 2. New Customer Information 3. Quit 1 Id: 1 -> Customer: Name = Swaminathan Bhaskar, Address = 100 North Pole 1. Get Customer Information 2. New Customer Information 3. Quit 2 Name: Bill Gates Address: 200 South Pole Zip: Persisted Customer information for Bill Gates 1. Get Customer Information 2. New Customer Information 3. Quit 1 Id: 2 -> Customer: Name = Bill Gates, Address = 200 South Pole 1. Get Customer Information 2. New Customer Information 3. Quit 3 As you see, when we query for a Customer, its related Address entity is also automatically fetched for us. We have successfully deployed and executed the example depicting the unidirectional one-to-one relationship between any Customer and their Address. Let us explore the case of bidirectional one-to-one entity relationship. The relationship between any Driver and their License is one-to-one bidirectional relationship because one can look up the Driver

7 given a License and also vice versa. The following diagram illustrates the relationship: Before we proceed with the example, we need to setup the two tables in the MySQL database testdb as follows: CREATE TABLE LICENSE_TBL ( LIC_ID INTEGER AUTO_INCREMENT, NUMBER VARCHAR(25) NOT NULL, STATE CHAR(2) NOT NULL, PRIMARY KEY PK_LIC_ID(LIC_ID) ); CREATE TABLE DRIVER_TBL ( NAME VARCHAR(50) NOT NULL, AGE INTEGER, DRV_LIC_ID INTEGER, PRIMARY KEY PK_NAME(NAME), CONSTRAINT DRV_LIC_FK FOREIGN KEY (DRV_LIC_ID) REFERENCES LICENSE_TBL(LIC_ID) ); The following code shows the Driver Entity Bean: Name: Bhaskar S package drvlic.common; public class Driver implements java.io.serializable { private static final long serialversionuid = private String name; private private License license; public String getname() { return name;

8 public void setname(string n) { name = n; public License getlicense() { return license; public void setlicense(license arg) { license = arg; public int getage() { return age; public void setage(int age) { this.age = age; annotation indicates that the Driver entity is related to the License entity via the join column DRV_LIC_ID. The following code shows the License Entity Bean: Name: Bhaskar S package drvlic.common; public class License implements java.io.serializable { private static final long serialversionuid = private int id; private String number; private String private Driver driver; public int getid() { return id; public void setid(int id) { this.id = id; public String getnumber() { return number; public void setnumber(string arg) { number = arg;

9 public String getstate() { return state; public void setstate(string arg) { state = arg; public Driver getdriver() { return driver; public void setdriver(driver arg) { driver = arg; The License entity uses auto generated primary key column (ADDR_ID). annotation with the mappedby attribute is what sets the bidirectional relationship with the Driver entity. The mappedby attribute indicates that the one-to-one mapping between Driver and License entities is specified in the Driver entity in the data member named license. The following code shows the Remote interface for DriverLicense: Name: Bhaskar S package drvlic.remote; import javax.ejb.remote; import public interface DriverLicense { public Driver getdriver(string name); public License getlicense(int id); public void adddriverlicense(string name, int age, String number, String state); The DriverLicense interface allows us to add a new Driver and its related License, lookup an existing Driver and its related License, or lookup an existing License and its related Driver (bidirectional relationship). The following shows the code for DriverLicenseBean stateless session bean: Name: Bhaskar S package drvlic.ejb; import drvlic.remote.driverlicense;

10 import drvlic.common.; import javax.ejb.stateless; import javax.persistence.entitymanager; import public class DriverLicenseBean implements DriverLicense private EntityManager public Driver getdriver(string name) { Driver drv = _emgr.find(driver.class, name); if (drv!= null) { System.out.println("-> Driver<Query>: Age = " + drv.getage() + ", License No = " + drv.getlicense().getnumber()); return public License getlicense(int id) { License lic = _emgr.find(license.class, id); if (lic!= null) { System.out.println("-> License<Query>: Age = " + lic.getdriver().getage() + ", License No = " + lic.getnumber()); return public void adddriverlicense(string name, int age, String number, String state) { License lic = new License(); lic.setnumber(number); lic.setstate(state); Driver drv = new Driver(); drv.setname(name); drv.setage(age); drv.setlicense(lic); lic.setdriver(drv); _emgr.persist(drv); System.out.println("-> DriverLicense<Persist>: Age = " + lic.getdriver().getage() + ", License No = " + lic.getnumber()); If we skip the step highlighted in the code, we will encounter a NullPointerException. This step is what completes the bidirectional relationship. The following shows the code for a standalone client that is accessing the DriverLicenseBean stateless session bean through the remote interface DriverLicense: Name: Bhaskar S package drvlic.client; import drvlic.remote.driverlicense; import drvlic.common.; import java.io.bufferedreader; import java.io.inputstreamreader; import javax.naming.context;

11 import javax.naming.initialcontext; public class DriverLicenseClient { public static void main(string[] args) { try { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); Context ctx = new InitialContext(); DriverLicense drvlic = (DriverLicense) ctx.lookup("driverlicense/remote"); boolean exit = false; while (! exit) { System.out.println("1. Get Driver Information"); System.out.println("2. Get License Information"); System.out.println("3. New Driver-License Information"); System.out.println("4. Quit"); String choice = input.readline(); if (choice.equals("1")) { System.out.print("Name: "); String name = input.readline(); Driver drv = drvlic.getdriver(name); if (drv!= null) { License lic = drv.getlicense(); System.out.println("-> Driver: Age = " + drv.getage() + ", License No = " + lic.getnumber()); else { System.out.println("No Driver information for " + name); else if (choice.equals("2")) { System.out.print("Id: "); String idstr = input.readline(); License lic = drvlic.getlicense(integer.parseint(idstr)); if (lic!= null) { Driver drv = lic.getdriver(); System.out.println("-> License: Age = " + drv.getage() + ", License No = " + lic.getnumber()); else { System.out.println("No License information for " + idstr); else if (choice.equals("3")) { System.out.print("Name: "); String name = input.readline(); System.out.print("Age: "); String agestr = input.readline(); System.out.print("Number: "); String number = input.readline(); System.out.print("State: "); String state = input.readline(); drvlic.adddriverlicense(name, Integer.parseInt(agestr), number, state); System.out.println("Persisted Driver-License information for " + name); else if (choice.equals("4")) { exit = true; catch (Throwable ex) { ex.printstacktrace(system.err); Next, we will compile and deploy the EJB jar my_ejb_beans.jar into the JBoss Application Server.

12 Now, open a Terminal window and execute the script DriverLicense.sh as illustrated below: $./DriverLicense.sh 1. Get Driver Information 2. Get License Information 3. New Driver-License Information 4. Quit 3 Name: Swaminathan Bhaskar Age: 40 Number: State: NJ Persisted Driver-License information for Swaminathan Bhaskar 1. Get Driver Information 2. Get License Information 3. New Driver-License Information 4. Quit 1 Name: Swaminathan Bhaskar -> Driver: Age = 40, License No = Get Driver Information 2. Get License Information 3. New Driver-License Information 4. Quit 2 Id: 1 -> License: Age = 40, License No = Get Driver Information 2. Get License Information 3. New Driver-License Information 4. Quit 4 As you see, when we query for a Driver, its related License entity is also automatically fetched for us. Similarly, when we query for a License, its related Driver entity is also automatically fetched for us. We have successfully deployed and executed the example depicting the bidirectional one-to-one relationship between any Driver and their License. Let us explore the many-to-one entity relationship. There is only Unidirectional many-to-one. The Bidirectional many-to-one is the same as Bidirectional one-to-many. Hence, in the following example we will look at unidirectional many-to-one. The relationship between the Items in an Order is many-to-one unidirectional relationship. Each Item entity knows which Order entity it is associated with, but the Order entity is oblivious of that relationship. The following diagram illustrates the relationship:

13 Before we proceed with the example, we need to setup the two tables in the MySQL database testdb as follows: CREATE TABLE ORDER_TBL ( ORDER_NO INTEGER AUTO_INCREMENT, ORDER_DATE DATE NOT NULL, CUST_NAME VARCHAR(50) NOT NULL, PRIMARY KEY PK_ORDER_NO(ORDER_NO) ); CREATE TABLE ITEM_TBL ( ITEM_NAME VARCHAR(25) NOT NULL, QUANTITY INTEGER, ITEM_ORD_NO INTEGER, PRIMARY KEY PK_NAME(ITEM_NAME), CONSTRAINT ITEM_ORD_FK FOREIGN KEY (ITEM_ORD_NO) REFERENCES ORDER_TBL(ORDER_NO) ); The following code shows the Order Entity Bean: Name: Bhaskar S package itmord.common; import java.util.date; public class Order implements java.io.serializable { private static final long serialversionuid = private int private Date private String name; public int getno() { return no;

14 public void setno(int n) { no = n; public Date getdate() { return date; public void setdate(date d) { date = d; public String getname() { return name; public void setname(string n) { name = n; public String tostring() { StringBuffer sb = new StringBuffer(); sb.append("-> Order no: "); sb.append(no); sb.append(", Order date: "); sb.append(date.tostring()); sb.append(", Customer name: "); sb.append(name); return sb.tostring(); The Order entity uses auto generated primary key column (ORDER_NO). The following code shows the Item Entity Bean: Name: Bhaskar S package itmord.common; public class Item implements java.io.serializable { private static final long serialversionuid private String private private Order order; public String getname() { return name; public void setname(string n) { name = n;

15 public int getqty() { return qty; public void setqty(int q) { qty = q; public Order getorder() { return order; public void setorder(order ord) { order = ord; annotation indicates the many-to-one relationship between the Item and the Order entity. The following code shows the Remote interface for ItemOrder: Name: Bhaskar S package itmord.remote; import java.util.date; import javax.ejb.remote; import public interface ItemOrder { public void addorderwithitems(date dt, String name, String[] item, Integer[] qty); public Order getorderforitem(string name); The ItemOrder interface allows us to add a new Order and its related Items or lookup an existing Order corresponding to an Item. The following shows the code for ItemOrderBean stateless session bean: Name: Bhaskar S package itmord.ejb; import java.util.date; import itmord.common.; import itmord.remote.itemorder; import javax.ejb.stateless; import javax.persistence.entitymanager;

16 import public class ItemOrderBean implements ItemOrder private EntityManager public void addorderwithitems(date dt, String name, String[] item, Integer[] qty) { Order ord = new Order(); ord.setdate(dt); ord.setname(name); _emgr.persist(ord); for (int i = 0; i < item.length; i++) { Item itm = new Item(); itm.setname(item[i]); itm.setqty(qty[i]); itm.setorder(ord); public Order getorderforitem(string name) { Item itm = _emgr.find(item.class, name); if (itm!= null) { return itm.getorder(); return null; The following shows the code for a standalone client that is accessing the ItemOrderBean stateless session bean through the remote interface ItemOrder: Name: Bhaskar S package itmord.client; import java.util.; import itmord.common.; import itmord.remote.itemorder; import java.io.bufferedreader; import java.io.inputstreamreader; import javax.naming.context; import javax.naming.initialcontext; public class ItemOrderClient { public static void main(string[] args) { try { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); Context ctx = new InitialContext(); ItemOrder stub = (ItemOrder) ctx.lookup("itemorder/remote"); boolean exit = false; while (! exit) { System.out.println("1. Add New Order With Items"); System.out.println("2. Get Order For Item"); System.out.println("3. Quit");

17 String choice = input.readline(); if (choice.equals("1")) { System.out.print("Customer Name: "); String name = input.readline(); List<String> items = new ArrayList<String>(); List<Integer> qtys = new ArrayList<Integer>(); for (;;) { System.out.print("Item Name <Enter to quit>: "); String itm = input.readline(); if (itm!= null && itm.trim().length() > 0) { System.out.print("Quantity: "); String qstr = input.readline(); int qt = Integer.parseInt(qstr); if (qt > 0) { items.add(itm); qtys.add(qt); else { break; if (items.size() > 0) { stub.addorderwithitems(new Date(), name, items.toarray(new String[0]), qtys.toarray(new Integer[0])); System.out.println("-> Persisted new order with items"); items.clear(); qtys.clear(); else if (choice.equals("2")) { System.out.print("Item Name: "); String itm = input.readline(); Order ord = stub.getorderforitem(itm); if (ord!= null) { System.out.println(ord.toString()); else { System.out.println("-> No order found for item " + itm); else if (choice.equals("3")) { exit = true; catch (Throwable ex) { ex.printstacktrace(system.err); Next, we will compile and deploy the EJB jar my_ejb_beans.jar into the JBoss Application Server. Now, open a Terminal window and execute the script ItemOrder.sh as illustrated below: $./ItemOrder.sh 1. Add New Order With Items 2. Get Order For Item 3. Quit 1 Customer Name: Swaminathan Bhaskar Item Name <Enter to quit>: Item-1

18 Quantity: 2 Item Name <Enter to quit>: Item-2 Quantity: 1 Item Name <Enter to quit>: Item-3 Quantity: 2 Item Name <Enter to quit>: -> Persisted new order with items 1. Add New Order With Items 2. Get Order For Item 3. Quit 2 Item Name: Item-2 -> Order no: 1, Order date: :00:00.0, Customer name: Swaminathan Bhaskar 1. Add New Order With Items 2. Get Order For Item 3. Quit 3 We have successfully deployed and executed the example depicting the unidirectional many-to-one relationship between an Order and its Items. We will continue to explore EJB Entity Beans Using Java Persistence in Part-6.3 of this series.

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

Exploring EJB3 With JBoss Application Server Part - 5

Exploring EJB3 With JBoss Application Server Part - 5 By Swaminathan Bhaskar 12/13/2008 Exploring EJB3 With JBoss Application Server Part - 5 In this part, we will first explore EJB Timer Service and then look at Interceptors. 7. EJB Timer Service A Timer

More information

EJB - ACCESS DATABASE

EJB - ACCESS DATABASE EJB - ACCESS DATABASE http://www.tutorialspoint.com/ejb/ejb_access_database.htm Copyright tutorialspoint.com EJB 3.0, persistence mechanism is used to access the database in which container manages the

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

EJB - INTERCEPTORS. Interceptor methods can be applied or bound at three levels

EJB - INTERCEPTORS. Interceptor methods can be applied or bound at three levels http://www.tutorialspoint.com/ejb/ejb_interceptors.htm EJB - INTERCEPTORS Copyright tutorialspoint.com EJB 3.0 provides specification to intercept business methods calls using methods annotated with @AroundInvoke

More information

Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics:

Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics: Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics: EJB 3 entities Java persistence API Mapping an entity to a database table

More information

JPA Entities. Course Multi Tier Business Applications with Java EE. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel. Berner Fachhochschule

JPA Entities. Course Multi Tier Business Applications with Java EE. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel. Berner Fachhochschule Berner Fachhochschule Technik und Informatik JPA Entities Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content Characteristics of entities Programming

More information

EJB 3 Entities. Course Multi Tier Business Applications with Java EE. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel. Berner Fachhochschule

EJB 3 Entities. Course Multi Tier Business Applications with Java EE. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel. Berner Fachhochschule Berner Fachhochschule Technik und Informatik EJB 3 Entities Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content Characteristics of entities Programming

More information

EJB 3 Entity Relationships

EJB 3 Entity Relationships Berner Fachhochschule Technik und Informatik EJB 3 Entity Relationships Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content What are relationships?

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

EJB 3 Entity Relationships

EJB 3 Entity Relationships Berner Fachhochschule Technik und Informatik EJB 3 Entity Relationships Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content What are relationships?

More information

EJB - DEPENDENCY INJECTION

EJB - DEPENDENCY INJECTION EJB - DEPENDENCY INJECTION http://www.tutorialspoint.com/ejb/ejb_dependency_injection.htm Copyright tutorialspoint.com EJB 3.0 specification provides annotations which can be applied on fields or setter

More information

Webservice Inheritance

Webservice Inheritance Webservice Inheritance Example webservice-inheritance can be browsed at https://github.com/apache/tomee/tree/master/examples/webservice-inheritance Help us document this example! Click the blue pencil

More information

Introduction to Session beans EJB 3.0

Introduction to Session beans EJB 3.0 Introduction to Session beans EJB 3.0 Remote Interface EJB 2.1 ===================================================== public interface Hello extends javax.ejb.ejbobject { /** * The one method - hello -

More information

WHAT IS EJB. Security. life cycle management.

WHAT IS EJB. Security. life cycle management. EJB WHAT IS EJB EJB is an acronym for enterprise java bean. It is a specification provided by Sun Microsystems to develop secured, robust and scalable distributed applications. To run EJB application,

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

Java Persistence API (JPA) Entities

Java Persistence API (JPA) Entities Java Persistence API (JPA) Entities JPA Entities JPA Entity is simple (POJO) Java class satisfying requirements of JavaBeans specification Setters and getters must conform to strict form Every entity must

More information

SUN Sun Cert Bus Component Developer Java EE Platform 5, Upgrade. Download Full Version :

SUN Sun Cert Bus Component Developer Java EE Platform 5, Upgrade. Download Full Version : SUN 310-092 Sun Cert Bus Component Developer Java EE Platform 5, Upgrade Download Full Version : https://killexams.com/pass4sure/exam-detail/310-092 D. A javax.ejb.nosuchentityexception is thrown. Answer:

More information

Java EE Architecture, Part Three. Java EE architecture, part three 1(69)

Java EE Architecture, Part Three. Java EE architecture, part three 1(69) Java EE Architecture, Part Three Java EE architecture, part three 1(69) Content Requirements on the Integration layer The Database Access Object, DAO Pattern Frameworks for the Integration layer Java EE

More information

JPA. Java persistence API

JPA. Java persistence API JPA Java persistence API JPA Entity classes JPA Entity classes are user defined classes whose instances can be stored in a database. JPA Persistable Types The term persistable types refers to data types

More information

Enterprise JavaBeans, Version 3 (EJB3) Programming

Enterprise JavaBeans, Version 3 (EJB3) Programming Enterprise JavaBeans, Version 3 (EJB3) Programming Description Audience This course teaches developers how to write Java Enterprise Edition (JEE) applications that use Enterprise JavaBeans, version 3.

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

WES-CS GROUP MEETING #9

WES-CS GROUP MEETING #9 WES-CS GROUP MEETING #9 Exercise 1: Practice Multiple-Choice Questions 1. What is output when the following code executes? String S1 = new String("hello"); String S2 = S1 +! ; S1 = S1 + S1; System.out.println(S1);

More information

1Z Oracle. Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade

1Z Oracle. Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade Oracle 1Z0-861 Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade Download Full Version : https://killexams.com/pass4sure/exam-detail/1z0-861 A. The Version attribute

More information

Integrating NWDS with a Non-SAP Server (JBoss AS) to Develop and Deploy Java EE Applications

Integrating NWDS with a Non-SAP Server (JBoss AS) to Develop and Deploy Java EE Applications Integrating NWDS with a Non-SAP Server (JBoss AS) to Develop and Deploy Java EE Applications Applies to: This article applies to SAP NetWeaver Developer Studio, SAP NetWeaver 7.1 CE SP03 PAT0000 Summary

More information

EJB 3.0 Puzzlers. Mike Keith, Oracle Corp. Colorado Software Summit: October 21 26, 2007

EJB 3.0 Puzzlers. Mike Keith, Oracle Corp.   Colorado Software Summit: October 21 26, 2007 EJB 3.0 Puzzlers Mike Keith, Oracle Corp. michael.keith@oracle.com http://otn.oracle.com/ejb3 Slide 1 About Me Co-spec Lead of EJB 3.0 (JSR 220) and Java EE 5 (JSR 244) expert group member Currently working

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

Topics in Enterprise Information Management

Topics in Enterprise Information Management Topics in Enterprise Information Management Dr. Ilan Kirsh JPA Basics Object Database and ORM Standards and Products ODMG 1.0, 2.0, 3.0 TopLink, CocoBase, Castor, Hibernate,... EJB 1.0, EJB 2.0: Entity

More information

JPA The New Enterprise Persistence Standard

JPA The New Enterprise Persistence Standard JPA The New Enterprise Persistence Standard Mike Keith michael.keith@oracle.com http://otn.oracle.com/ejb3 About Me Co-spec Lead of EJB 3.0 (JSR 220) Java EE 5 (JSR 244) expert group member Co-author Pro

More information

Injection Of Entitymanager

Injection Of Entitymanager Injection Of Entitymanager Example injection-of-entitymanager can be browsed at https://github.com/apache/tomee/tree/master/examples/injection-ofentitymanager This example shows use of @PersistenceContext

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

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

Fast Track to EJB 3.0 and the JPA Using JBoss

Fast Track to EJB 3.0 and the JPA Using JBoss Fast Track to EJB 3.0 and the JPA Using JBoss The Enterprise JavaBeans 3.0 specification is a deep overhaul of the EJB specification that is intended to improve the EJB architecture by reducing its complexity

More information

Stateful Session Beans

Stateful Session Beans Berner Fachhochschule Technik und Informatik Stateful Session Beans Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content Characteristics of stateful

More information

ClassLevelInterceptorOne

ClassLevelInterceptorOne Interceptors Example interceptors can be browsed at https://github.com/apache/tomee/tree/master/examples/interceptors Help us document this example! Click the blue pencil icon in the upper right to edit

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

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

Simple Data Source Crawler Plugin to Set the Document Title

Simple Data Source Crawler Plugin to Set the Document Title Simple Data Source Crawler Plugin to Set the Document Title IBM Content Analytics 1 Contents Introduction... 4 Basic FS Crawler behavior.... 8 Using the Customizer Filter to Modify the title Field... 13

More information

Communication Software Exam 5º Ingeniero de Telecomunicación January 26th Name:

Communication Software Exam 5º Ingeniero de Telecomunicación January 26th Name: Duration: Marks: 2.5 hours (+ half an hour for those students sitting part III) 8 points (+ 1 point for part III, for those students sitting this part) Part II: problems Duration: 2 hours Marks: 4 points

More information

Java EE Architecture, Part Three. Java EE architecture, part three 1(57)

Java EE Architecture, Part Three. Java EE architecture, part three 1(57) Java EE Architecture, Part Three Java EE architecture, part three 1(57) Content Requirements on the Integration layer The Database Access Object, DAO Pattern Frameworks for the Integration layer Java EE

More information

Practice 2. SOAP & REST

Practice 2. SOAP & REST Enterprise System Integration Practice 2. SOAP & REST Prerequisites Practice 1. MySQL and JPA Introduction JAX-WS stands for Java API for XML Web Services. JAX-WS is a technology for building web services

More information

jar command Java Archive inherits from tar : Tape Archive commands: jar cvf filename jar tvf filename jar xvf filename java jar filename.

jar command Java Archive inherits from tar : Tape Archive commands: jar cvf filename jar tvf filename jar xvf filename java jar filename. jar & jar files jar command Java Archive inherits from tar : Tape Archive commands: jar cvf filename jar tvf filename jar xvf filename java jar filename.jar jar file A JAR file can contain Java class files,

More information

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade; Control Statements Control Statements All programs could be written in terms of only one of three control structures: Sequence Structure Selection Structure Repetition Structure Sequence structure The

More information

Selected Questions from by Nageshwara Rao

Selected Questions from  by Nageshwara Rao Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

Entity LifeCycle Callback Methods Srikanth Technologies Page : 1

Entity LifeCycle Callback Methods Srikanth Technologies Page : 1 Entity LifeCycle Callback Methods Srikanth Technologies Page : 1 Entity LifeCycle Callback methods A method may be designated as a lifecycle callback method to receive notification of entity lifecycle

More information

Object Oriented Programming (II)

Object Oriented Programming (II) Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 11 Object

More information

Dynamic Datasource Routing

Dynamic Datasource Routing Dynamic Datasource Routing Example dynamic-datasource-routing can be browsed at https://github.com/apache/tomee/tree/master/examples/dynamic-datasourcerouting The TomEE dynamic datasource api aims to allow

More information

Goals for Today. CSE1030 Introduction to Computer Science II. CSE1030 Lecture #9. Review is-a versus has-a. Lecture #9 Inheritance I

Goals for Today. CSE1030 Introduction to Computer Science II. CSE1030 Lecture #9. Review is-a versus has-a. Lecture #9 Inheritance I CSE1030 Introduction to Computer Science II Lecture #9 Inheritance I Goals for Today Today we start discussing Inheritance (continued next lecture too) This is an important fundamental feature of Object

More information

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7 CONTENTS Chapter 1 Introducing EJB 1 What is Java EE 5...2 Java EE 5 Components... 2 Java EE 5 Clients... 4 Java EE 5 Containers...4 Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

More information

Selecting a Primary Key - 2

Selecting a Primary Key - 2 Software Architectures and Methodologies A.A 2016/17 Java Persistence API Mapping, Inheritance and Performance Primary Key Dipartimento di Ingegneria dell'informazione Laboratorio Tecnologie del Software

More information

FIFO PAGE REPLACEMENT : import java.io.*; public class FIFO {

FIFO PAGE REPLACEMENT : import java.io.*; public class FIFO { FIFO PAGE REPLACEMENT : import java.io.*; public class FIFO public static void main(string[] args) throws IOException BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int frames,

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

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

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

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Web Application Development Using JEE, Enterprise JavaBeans and JPA Web Application Development Using JEE, Enterprise Java and JPA Duration: 35 hours Price: $750 Delivery Option: Attend training via an on-demand, self-paced platform paired with personal instructor facilitation.

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

Practical EJB 3.0. Bill Burke JBoss Fellow Red Hat. Easier for application and framework developers. Professional Open Source

Practical EJB 3.0. Bill Burke JBoss Fellow Red Hat. Easier for application and framework developers. Professional Open Source Practical EJB 3.0 Easier for application and framework developers Bill Burke JBoss Fellow Red Hat JBoss, Inc. 2003-2005. 10/30/2007 1 Agenda Using EJB with JPA How EJBs makes JPA easier for application

More information

King Saud University College of Computer and Information Systems Department of Computer Science CSC 113: Java Programming-II, Spring 2016

King Saud University College of Computer and Information Systems Department of Computer Science CSC 113: Java Programming-II, Spring 2016 Create the classes along with the functionality given in the following UML Diagram. To understand the problem, please refer to the description given after the diagram. Node +Node(e:Employee) +getdata():employee

More information

Simple Stateless with Descriptor

Simple Stateless with Descriptor Simple Stateless with Descriptor Example simple-stateless-with-descriptor can be browsed at https://github.com/apache/tomee/tree/master/examples/simple-stateless-withdescriptor This test is similar to

More information

PASS4TEST IT 인증시험덤프전문사이트

PASS4TEST IT 인증시험덤프전문사이트 PASS4TEST IT 인증시험덤프전문사이트 http://www.pass4test.net 일년동안무료업데이트 Exam : 1z0-809 Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-809 Exam's Question and Answers 1 from

More information

The Good, the Bad and the Ugly

The Good, the Bad and the Ugly The Good, the Bad and the Ugly 2 years with Java Persistence API Björn Beskow bjorn.beskow@callistaenterprise.se www.callistaenterprise.se Agenda The Good Wow! Transparency! The Bad Not that transparent

More information

Model Driven Architecture with Java

Model Driven Architecture with Java Model Driven Architecture with Java Gregory Cranz Solutions Architect Arrow Electronics, Inc. V20061005.1351 Page Number.1 Who am I? Solutions Architect Software Developer Java Early Adopter Page Number.2

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

Testing Transactions BMT

Testing Transactions BMT Testing Transactions BMT Example testing-transactions-bmt can be browsed at https://github.com/apache/tomee/tree/master/examples/testing-transactions-bmt Shows how to begin, commit and rollback transactions

More information

Software Practice 1 - Basic Grammar Basic Syntax Data Type Loop Control Making Decision

Software Practice 1 - Basic Grammar Basic Syntax Data Type Loop Control Making Decision Software Practice 1 - Basic Grammar Basic Syntax Data Type Loop Control Making Decision Prof. Hwansoo Han T.A. Minseop Jeong T.A. Wonseok Choi 1 Java Program //package details public class ClassName {

More information

Accurate study guides, High passing rate! Testhorse provides update free of charge in one year!

Accurate study guides, High passing rate! Testhorse provides update free of charge in one year! Accurate study guides, High passing rate! Testhorse provides update free of charge in one year! http://www.testhorse.com Exam : 1Z0-850 Title : Java Standard Edition 5 and 6, Certified Associate Exam Version

More information

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines

More information

MODEL DRIVEN DEVELOPMENT OF COMPONENTS (IS7/IV2009)

MODEL DRIVEN DEVELOPMENT OF COMPONENTS (IS7/IV2009) MODEL DRIVEN DEVELOPMENT OF COMPONENTS (IS7/IV2009) Spring 2010 V3.0.3 Tutorial 2 Component Based Development with Enterprise Java Beans nikos dimitrakas & Martin Henkel Department of Computer and Systems

More information

Simple Entity EJB - xdoclet, MyEclipse, Jboss and PostgreSql, MySql

Simple Entity EJB - xdoclet, MyEclipse, Jboss and PostgreSql, MySql Simple Entity EJB - xdoclet, MyEclipse, Jboss and PostgreSql, MySql Creation and testing of a first Entity Bean using MyEcplise, Jboss and xdoclet. General Author: Sebastian Hennebrüder http://www.laliluna.de/tutorial.html

More information

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Web Application Development Using JEE, Enterprise JavaBeans and JPA Web Application Development Using JEE, Enterprise Java and JPA Duration: 5 days Price: $2795 *California residents and government employees call for pricing. Discounts: We offer multiple discount options.

More information

Java Persistence API. Patrick Linskey EJB Team Lead BEA Systems Oracle

Java Persistence API. Patrick Linskey EJB Team Lead BEA Systems Oracle Java Persistence API Patrick Linskey EJB Team Lead BEA Systems Oracle plinskey@bea.com Patrick Linskey EJB Team Lead at BEA JPA 1, 2 EG Member Agenda JPA Basics What s New ORM Configuration APIs Queries

More information

CO Java EE 6: Develop Database Applications with JPA

CO Java EE 6: Develop Database Applications with JPA CO-77746 Java EE 6: Develop Database Applications with JPA Summary Duration 4 Days Audience Database Developers, Java EE Developers Level Professional Technology Java EE 6 Delivery Method Instructor-led

More information

Full file at Chapter 2 - Inheritance and Exception Handling

Full file at   Chapter 2 - Inheritance and Exception Handling Chapter 2 - Inheritance and Exception Handling TRUE/FALSE 1. The superclass inherits all its properties from the subclass. ANS: F PTS: 1 REF: 76 2. Private members of a superclass can be accessed by a

More information

(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution

(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution Ch 5 Arrays Multiple Choice Test 01. An array is a ** (A) data structure with one, or more, elements of the same type. (B) data structure with LIFO access. (C) data structure, which allows transfer between

More information

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition CMP 436/774 Introduction to Java Enterprise Edition Fall 2013 Department of Mathematics and Computer Science Lehman College, CUNY 1 Java Enterprise Edition Developers today increasingly recognize the need

More information

EJB 2 - Complex Container Managed Relations (CMP) with JBoss

EJB 2 - Complex Container Managed Relations (CMP) with JBoss EJB 2 - Complex Container Managed Relations (CMP) with JBoss In this tutorial we will show you multiple examples to create CMP relations between EJB. We will use xdoclet to create the interfaces you will

More information

Information systems modelling UML and service description languages

Information systems modelling UML and service description languages Internet Engineering Tomasz Babczyński, Zofia Kruczkiewicz Tomasz Kubik Information systems modelling UML and service description languages Laboratory 3 Examplary multitiered Information System (Java EE

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

Refactoring to Seam. NetBeans. Brian Leonard Sun Microsystems, Inc. 14o

Refactoring to Seam. NetBeans. Brian Leonard Sun Microsystems, Inc. 14o Refactoring to Seam NetBeans Brian Leonard Sun Microsystems, Inc. 14o AGENDA 2 > The Java EE 5 Programming Model > Introduction to Seam > Refactor to use the Seam Framework > Seam Portability > Q&A Java

More information

4. Finding & Displaying Record of Salesman with minimum net income. 5. Finding & Displaying Record of Salesman with maximum net income.

4. Finding & Displaying Record of Salesman with minimum net income. 5. Finding & Displaying Record of Salesman with maximum net income. Solution of problem#55 of Lab Assignment Problem Statement: Design & Implement a java program that can handle salesmen records of ABC Company. Each salesman has unique 4 digit id #, name, salary, monthly

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

CS Week 11. Jim Williams, PhD

CS Week 11. Jim Williams, PhD CS 200 - Week 11 Jim Williams, PhD This Week 1. Exam 2 - Thursday 2. Team Lab: Exceptions, Paths, Command Line 3. Review: Muddiest Point 4. Lecture: File Input and Output Objectives 1. Describe a text

More information

A COMPONENT BASED ONLINE ORDERING SYSTEM USING ENTERPRISE JAVABEANS 3.0

A COMPONENT BASED ONLINE ORDERING SYSTEM USING ENTERPRISE JAVABEANS 3.0 A COMPONENT BASED ONLINE ORDERING SYSTEM USING ENTERPRISE JAVABEANS 3.0 AUTHOR: JAMES OSBORNE SUPERVISOR: DR. KUNG KIU LAU 2 MAY 2007 ABSTRACT Title: A Component Based Online Ordering System Using Enterprise

More information

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question)

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question) CS/B.TECH/CSE(New)/SEM-5/CS-504D/2013-14 2013 OBJECT ORIENTED PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

Introduction to Java Enterprise Edition For Database Application Developer

Introduction to Java Enterprise Edition For Database Application Developer CMP 420/758 Introduction to Java Enterprise Edition For Database Application Developer Department of Mathematics and Computer Science Lehman College, the CUNY 1 Java Enterprise Edition Developers today

More information

public static boolean isoutside(int min, int max, int value)

public static boolean isoutside(int min, int max, int value) See the 2 APIs attached at the end of this worksheet. 1. Methods: Javadoc Complete the Javadoc comments for the following two methods from the API: (a) / @param @param @param @return @pre. / public static

More information

1 of 6 11/08/2011 10:14 AM 1. Introduction 1.1. Project/Component Working Name: SJSAS 9.1, Support for JDBC 4.0 in JDBC RA, RFEs 1.2. Name(s) and e-mail address of Document Author(s)/Supplier: Jagadish

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

CS1092: Tutorial Sheet: No 3 Exceptions and Files. Tutor s Guide

CS1092: Tutorial Sheet: No 3 Exceptions and Files. Tutor s Guide CS1092: Tutorial Sheet: No 3 Exceptions and Files Tutor s Guide Preliminary This tutorial sheet requires that you ve read Chapter 15 on Exceptions (CS1081 lectured material), and followed the recent CS1092

More information

The Continuing Adventures of Java Puzzlers: Tiger Traps

The Continuing Adventures of Java Puzzlers: Tiger Traps The Continuing Adventures of Java Puzzlers: Tiger Traps Joshua Bloch and Neal Gafter Google Inc. TS-1188 2006 JavaOne SM Conference Session TS-1188 Introduction Eight more Java platform puzzles Short program

More information

Class, Variable, Constructor, Object, Method Questions

Class, Variable, Constructor, Object, Method Questions Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx

More information

(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution

(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution Ch 5 Arrays Multiple Choice 01. An array is a (A) (B) (C) (D) data structure with one, or more, elements of the same type. data structure with LIFO access. data structure, which allows transfer between

More information

CSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige

CSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige CSC 308 2.0 System Development with Java Exception Handling Department of Statistics and Computer Science 1 2 Errors Errors can be categorized as several ways; Syntax Errors Logical Errors Runtime Errors

More information

import java.io.*; class OutputExample { public static void main(string[] args) { try{ PrintWriter pw = new PrintWriter

import java.io.*; class OutputExample { public static void main(string[] args) { try{ PrintWriter pw = new PrintWriter class OutputExample try PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter("test1.txt"))); pw.println("outputexample pw.close() catch(ioexception e) System.out.println(" class InputExample

More information

SESSION ENDING EXAMINATION CLASS XI SUBJECT : INFORMATICS PRACTICES (065) Time Allowed : 3 Hrs. Max Marks : 70

SESSION ENDING EXAMINATION CLASS XI SUBJECT : INFORMATICS PRACTICES (065) Time Allowed : 3 Hrs. Max Marks : 70 SESSION ENDING EXAMINATION CLASS XI SUBJECT : INFORMATICS PRACTICES (065) Time Allowed : 3 Hrs. Max Marks : 70 Note : 1-This question paper is divided into three sections. 2- Section-A and Section-B are

More information

CSC 1214: Object-Oriented Programming

CSC 1214: Object-Oriented Programming CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:

More information

Java for Interfaces and Networks (DT3010, HT10)

Java for Interfaces and Networks (DT3010, HT10) Java for Interfaces and Networks (DT3010, HT10) More Basics: Classes, Exceptions, Garbage Collection, Interfaces, Packages Federico Pecora School of Science and Technology Örebro University federico.pecora@oru.se

More information

Introduction to Java https://tinyurl.com/y7bvpa9z

Introduction to Java https://tinyurl.com/y7bvpa9z Introduction to Java https://tinyurl.com/y7bvpa9z Eric Newhall - Laurence Meyers Team 2849 Alumni Java Object-Oriented Compiled Garbage-Collected WORA - Write Once, Run Anywhere IDE Integrated Development

More information