Monday, October 14, 2019
Comparison Of Persistence Framework Computer Science Essay
Comparison Of Persistence Framework Computer Science Essay Compare and contrast the following persistence frameworks: Java Persistence API (JPA), Hibernate and Java Database Connectivity. What improvements were made in EJB3.1 and JPA2? Include topics of scalability, security, connection pools, connection factories, entity management, transactional context, query languages, ORM, JCA, JNDI, the DAO-VO design pattern and specifically persistence layer(s) on a distributed n-tier enterprise platform in your discussion. Java Persistence API (JPA) JPA is an abstraction above JDBC that makes it possible to be independent of SQL. The main components of JPA are: ORM: Object relational mapping is a means to map objects to data stored in relational database [1]. JPA uses annotations and/or XML descriptor files to map POJO based java objects to relational database tables. CRUD: An entity manager manages lifecycle of JPA entities. It performs database related operations like create, retrieve, update and delete. JPQL: Java persistence query language allows writing CRUD queries using an object oriented query language. JTA: Java Transaction API provides transactions and locking mechanisms while accessing data concurrently. Callbacks and listeners: They hook business logic into the life cycle of a persistent object. Hibernate Hibernate is an Object relationship mapping framework. Hibernate helps in mapping POJO Java classes to SQL database tables. It has the power of significantly reducing development time. Hibernate uses annotations and/or XML (mapping) descriptor files to map the POJO Java objects in the application domain to relational database tables. Hibernate implements polymorphism and inheritance. Hibernate generated SQL maintains the portability of the application to all SQL databases. This HQL (SQL) allows create, retrieve, update and delete operations on POJO. This framework allows development of persistent Java classes which includes object oriented features like encapsulation, inheritance, polymorphism, and collections frameworks. Hibernate Query Language (HQL): This is an extremely powerful query language similar to SQL. HQL is an object oriented SQL. Like SQL using tables and columns, HQL uses classes and properties. This means HQL uses object models for relational operations. Hence, it is less verbose as compared to SQL. JDBC JDBC is a standard java API for accessing relational database used for persisting state. It connects to database executes SQL statements and gets result. JDBC can also be used in a distributed environment. JDBC makes connection with an underlying data source using Connection Interface. It uses following mechanisms for connections: DriverManager This class is the management layer of JDBC. DriverManager loads any JDBC 4.0 drivers when an application makes connection to a data source as a part of its initialization. Other JDBC drivers must be explicitly loaded. DataSource DataSource can be a legacy database, file system or some other source of data. It is preferred over DriveManager as it allows the underlying data source to be apparent to the application. The two important extensions of the DataSource interface are as follows: ConnectionPoolDataSource The connection pool names are configured in JNDI. They support caching and reusing of physical connections in a way improving application performance and scalability. XADataSource XAdataSource uses XAConnection objects internally. It establishes physical connection with the database using the given user name and password. The connection thus obtained can be used in distributed transaction. Session bean and JDBC: Java architecture implementing session beans along with JDBC, any persistence request is delegated to the JDBC tier by the session bean. Upon request, the session bean calls JDBC layer to obtain a reference to object of type javax.sql.DataSourceà interface. The DataSource type object serves acts as a resource manager factory forà java.sql.Connectionà objects (as outlined by JDBC specification) that implement connections to a database. Once aà Connectionà object is retrieved, the following business logic and persistence code (reads, updates, looping resultset, transaction commit/rollback etc.) are JDBC code. JDBC drawbacks Java applications initially used the JDBC API to create/read/update/delete/ data into relational databases. The JDBC API makes direct use of SQL statements to perform data persistence activities (create, read, update, and delete). When JDBC code is implemented in Java classes, the business logic gets tightly coupled to the Java class. The JDBC embeddable java code relies on SQL, which is not uniform across databases. Thus the code is tightly coupled to one type of database and hence difficult to migrate. Transactional Support: By default, JDBC drivers work in auto-commit mode, where each database SQL (read, update) is an atomic transaction. It is very easy to disable auto-commit, execute SQL in batch mode (multiple queries/updates) and then commit or rollback the transaction. DAO-VO A typical DAO (Data Access object) provides an interface that describes its contract with external interfaces. This outlines a series of methods for data persistence (CRUD operations). Generally a DAO is defined with a base interface and its methods are implemented by entity classes. A VO (Value object) is a simple POJO to transfer the data across various tiers of Java architecture. JDO For every method Persistence Manager is obtained, a transaction is fetched, and operations are executed. By availing attach/detach and fetch-groups, persisted objects are made available outside the DAO layer in a seamless way. Hibernate and JPA JPA acts as an adapter over Hibernate. JPA provides the entire API to interact with Hibernate. In a way JPA acts as an abstraction between the java code and Hibernate. In such a architecture it is easy to replace Hibernate if need be. JCA Java EE Connector Architecture (JCA) is a Java-based technology solution for connecting application servers and enterprise information systems (EIS) as part of enterprise application integration (EAI) solutions. While JDBC is specifically used to connect Java EE applications to databases, JCA is a more generic architecture for connection to legacy systems. What improvements were made in EJB3.1 and JPA2 Improvements in EJB 3.1 With EJB 3.1, there is no need to define home/local interfaces. Now EJB can be defined simple with an annotation. Singleton beans were introduced with EJB 3.1. Singleton beans can be used for shared data at application level. Asynchronous EJB calls are now supported with @Asynchronous method-level annotation. Packaging and deployment can be directly done in a war file. Session beans with a local view can be accessed without a separate local business interface. EJB Timer Service enhancements are also included to support scheduling jobs; Stateful Session Bean timed objects and deployment-time timer creation. Embedded container: A new embeddable API is available for executing EJB components within a Java SE environment (for unit testing, batch processing, etc.). EJB Lite: This definition of a lightweight subset of functionalities can be provided within Java EE Profiles (such as the Java EE Web Profile). Portable JNDI name: The syntax for looking up EJB components is now specified. Example: A Stateless EJB @Stateless public class CustomerEJB { @PersistenceContext(unitName = customerPU) private EntityManager em; public Customer findCustById(Long id) { return em.find(Customer.class, id); } public Customer createCust( Customer cust) { em.persist(cust); return cust; } } Improvements in JPA 2.0 Collections of basic types. Collections of embeddable. A persistent ordering is now maintained using the @OrderColumn annotation. Orphan removal that allows removal of child object when parent object is removed. Pessimistic locking has also been introduced along with optimistic locking. Foreign key mapping were introduced with JPA 2.0 for unidirectional one-to-many relationships. Improved support for maps (java HashMaps). Criteria query API which allows queries to be constructed in an object-oriented manner. Improvements in JPQL syntax. JPA 2.0 allows nesting of embeddable objects into other embeddable objects and has entity relationships. JPA 2.0 Example: @Entity @NamedQuery(name = findAllCust, query= select c from Customer c) public class Customer implements Serializable { @Id @GeneratedValue private Long id; @Column(name = cust_name) private String custName; public Customer() { } //à ¢Ã¢â ¬Ã ¦.Get and set methods @Override public String toString(){ StringBuilder sb = new StringBuilder(100); sb.append(id : );sb.append(id);sb.append( ; ); sb.append(custName : );sb.append(custName);sb.append( ; ); return sb.toString(); }
Sunday, October 13, 2019
The Mammy :: essays research papers
The Mammy à à à à à The Irish tale depicts the life of a woman named Agnes Browne. The cards have fallen more than once for her, but with the love of her 7 children and faith, Agnes never losses her strength. The author, Brendan Oââ¬â¢Carroll, adds elements of humor, tragedy, and love to this novel, which makes it hard to stop reading. Follow me as I talk about The Mammy and how her culture plays a part in her everyday life in the late 1960ââ¬â¢s, in Dublin, Ireland. à à à à à The book begins with the death of Agnes Browneââ¬â¢s husband Nicholas Browne, whom gets hit by a car. Agnes is now a widow and single parent to 7 children (6 boys and 1 girl), whom all range in ages 14-3. All of her children attend strict Catholic schools. Although her oldest son wants to drop out of school to help his mother support the household, she wants him to stay and continue. Agnes does not want him to end up like his father was, an abusive drunk, who worked as a janitor for more than 15 years. Though Nicholas Browne beat Agnes, he was never to touch the children. She was very protective of her children and everyone in Dublin knew it. à à à à à Now Agnes has to raise the children with the money she gets from the social service office, her stall where she sales her fresh produce everyday, and her Catholic belief. Agnes has a best friend by the name of Marion Monks. The two are very close and do everything together. They go to the local pub all the time and gossip and drink alcohol. The pub they hang out in everyone knew one another and were all very friendly, the neighborhood is very tight. With her very busy life Agnes does find time to daydream about her favorite singer named Cliff Diamond. She loves to listen to his records and relax. Agnes daydreams of him all the time wishing she could have one dance with him. à à à à à Then tragedy hits Agnes once again when Marion dies of cancer. She is saddened by the sudden death of her best friend, but she has such strong strength, she knows Marion is looking down on her. At the end of the book Agnesââ¬â¢ dream comes true when she is surprised with a visit from Cliff Diamond and looks up in the sky to thank her friend Marion for watching over her.
Saturday, October 12, 2019
How Concentration affects the rate of reaction :: GCSE Chemistry Coursework Investigation
How Concentration affects the rate of reaction I am investigating the rates of reaction and how the different variables can affect it. I know that the temperature, a catalyst, concentration, the surface area, light and pressure of a gas can affect the rate of reaction. In this particular experiment I am going to investigate on how the concentration of one of the reactants affects the rate of reaction. To show that the concentration does affect the rate of reaction I am going to carry out the reaction of sodium thiosulphate and hydrochloric acid. The reactant I am going to change in concentration for each experiment/reading is sodium thiosulphate. Word Equation Sodium + Hydrochloric Sodium + Sulphur + water + Sulphur Thiosulphate acid Chloride dioxide Chemical Equation ================= Na2S2O3(aq) + 2HCl(aq) -> 2NaCl(aq) + S(s) + H2O(l) + SO2(g) Equipment ========= Sodium Thiosulphate (NaSO) of different concentrations and volumes 5cm Hydrochloric acid (HCl) Water of different volumes Paper marked with a cross 2 Measuring cylinders Conical Flask Stopclock I will set the equipment up as shown in the diagram below Method I am going to measure out the right amount (50cmÃâà ³) and concentrations of the sodium thiosulphate and hydrochloric acid. I will vary the concentration of the sodium thiosulphate but will still keep the volume of the acid the same. I will keep the volume (5cmÃâà ³) and concentration (2.0 moi/dmÃâà ³) of the hydrochloric acid the same. The table below shows the amount of water I will add to the sodium thiosulphate to vary the concentration in each experiment. --------------------------------------------------------------------------------- Experiment Volume of 0.15 mol/dm (cm) Volume of water Concentration sodium Number sodium thiosulphate (cm (Cm) thiosulphate solution (mol/dm) 1 50 0 0.15 2 40 10 0.
Friday, October 11, 2019
Brave Incident Essay
High School Fight I went to high school in Vietnam; my cousin who I call brother went to the same high school with me. The high school I attended was also the school that many gang members attended. Those gang members always abused other students and took their lunch money as well as many of their valuables such as their wallets, cell phone and laptops. Our school principal always tried to inform the police about this behavior, but unfortunately that did not help. One day my class mate ran into the lass room where I was spending my break, since I did not like to hang out in the play ground because of the gang members that were there, and he told me that my cousin was being harassed by a couple of those gang members and that they threatened to beat him to death if he does not give them all his money. My cousin was very stubborn much more like Victoriano. The two gang members had my cousin against the wall and were trying to steal his wallet and belonging while he fought hem as much as he could. I had nothing on my mind at that moment but to save my cousin and help him run away from those gang members. I looked for small pieces or rocks and a wooden stick and immediately ran towards my cousin screaming loudly so that I can distract them from him. As I started throwing the rocks on them they let go of my cousin and paid attention to where I was heading which was directly towards them. I screamed loudly telling my cousin to run away and go to the rincipalââ¬â¢s office Just like when Dona Guadalupe told her cousin ââ¬Å"l am not cutting you free so you can be brave and get killed. I want you running so you can liveâ⬠I wanted my cousin to run and not try to fight the gang members when they let go of him. My cousin ran to the principalââ¬â¢s office while I threw the stick of wood towards them. I immediately changed my direction and ran towards the principalââ¬â¢s office as well. The Principal called the police and they arrested the gang members and I was able to save my cousin after all.
Thursday, October 10, 2019
Earning a Degree Through Distance Education Essay
We now live in a world where mobility is vital to our everyday existence. A world where access to everything must be instantaneous and adjustable in order to suit the ever accelerating pace of todayââ¬â¢s lifestyle. Everything today is taken for granted due to the ease by which everything can be had due to the advent of internet technology and its accompanying changes in work and education criteria. Gone are the days when we had to wake up at six in the morning in order to make it to school on time. No more long commutes nor cold winter days on the bus just to complete the school attendance and get that much coveted grade. For those of us who have not the luxury to attend a traditional educational institution, distance education is a godsend. In order to prove this point, I would like to present myself as a prime example of a skeptic who came to reap the benefits of distance education learning. Although not everybody is cut out to attend and eventually earn a college degree or its equivalent through distance education, most people who are considering going back to school believe just as I do, that it holds more benefits for us as students than those who have to attend a regular college. To begin with, distance education is beneficial to those who wish to complete their high school or college degree but do not have the time to take off from their daily tasks in life in order to commute to the school and attend to the regular student activities. What they do have time for is just to attend the classes at a venue that does not require so much time and effort to get to. Then possibly, they can squeeze in some study and homework time between their other duties at home or at the office. As a part time teacher and mother to three boisterous children, I can attest to the fact that if it were not for distance learning education, I would have given up on trying to attain an associate degree in Early Childhood Education even before I started the course. As a wife and mother, my priority will always be my family. But that is not to say that I should stop dreaming about advancing myself and getting further in my chosen career which is education. The only way I can do that is if I will be able to attend classes that have a flexible class schedule in order to accommodate the needs of my family. I found the solution in the distance learning classes. It was really very easy for e to get started in the classes because I had an open schedule and attended the classed online whenever I have the time to do so. I can attend classes while at home or on the road using my laptop and wi-fi internet connections. Due to the ease by which I can attend my classes, I never have a reason to miss a day of school. There is no such thing as my child being sick or my car breaking down so I could not come to class. Distance learning education also allows the student to learn more than just from lectures and classroom interaction. As a distance education learning student, I also learn from the school of real life and its accompanying experiences. I am not limited merely to what is taught to me because the only limitation available are the limits that I place upon myself. As a part time teacher, I have to admit that I had my doubts about distance learning education. I first thought of it as a lazy persons way of attending school. I thought that people who attended distance education classes were slackers without any dreams for their future. But, after giving the classes a fair chance, I realized that it was just like attending regular school, and sometimes, proves to even be more grueling if not for the fact that I am allowed to learn at my own pace and capability. The only competition I had was myself. As a mother, I benefit a lot from this system because it enables me to plan my classes around the activities of my children and make sure that I will always be available when they need me. It is no joke taking care of three children, one of whom is in her pre-adolescent stage and is in constant need of a motherââ¬â¢s guidance in her life. Distance education allows me to be a constant presence in my childrenââ¬â¢s lives and also allows us to bond together even while I attend classes because it becomes a fun activity for the family. While I attend my distance education classes, my children are sitting alongside me reading their lessons and working on their own assignments. Distance education has helped me improve my personal relationship with my children because they do not see mommy as simply an authority figure anymore whom they have to follow without question. They now see me as an equal who also makes mistakes and also has similar problems in school as they do. It gives us a common point for discussion as we compare our test results and talk about my classmates who they get to see over the webcam while I am in class. More importantly, distance education helps me save money on baby sitting payment for my nineteen month old son. Actually, distance learning education has helped my family save thousands of dollars a year that would have been spent on my daily commute to the university. These days, I can be home in a reasonable amount of time to spend with my husband and children before I attend the classes I signed up for after they have gone to bed. The detractors of distance education say that the quality of education suffers because of the questionable quality of education and interactivity between students and lecturers. My answer to this is simple, regular schools have to deal with the same problems on a daily basis. Nobody every questions the quality of their education or their lecturers. Just as I mentioned above, I too was a skeptic until I had tried and tested the system. Now, I definitely prefer the ease and simplicity of distance learning education for a college degree over attending the regular schools. Each of us have our own idea of what kind of educational institution will suit our individual needs and personalities, the choice of distance learning over traditional learning is something that falls under a personal preference. I have made my preference clear. Distance learning education has more advantages over traditional learning institutions in more ways than one simply because our lifestyles now have highly different requirements than the past decades. Thanks to the mobility offered by laptops, even the educational landscape will continue to change and evolve with the needs of the times. Something it did not have a need to do, nor have the capability to perform in the past. It is therefore my belief that earning a degree via distance learning education will soon become an acceptable and popular norm that shall be the wave of the future.
Wednesday, October 9, 2019
Why Does Mozart’s Talents and Lifestyle Cause Salieri to Take Revenge on God
ââ¬Å"Why? â⬠¦ What is my fault? â⬠¦ Until this day I have pursued virtue with rigor. I have labored long hours to relieve my fellow men. I have worked and worked the talent you allowed me. And now I do hear it-and it says only one name: MOZART!. â⬠It has been stated throughout the play Amadeus, by Peter Shaffer that two very unique and different characters both have the love of music. A man name Antonio Salieri and another name Wolfgang Amadeus Mozart. However, one individual becomes envious of a manââ¬â¢s genius work, and lifestyle. A person name Antonio Salieri because throughout the play Amadeus, Salieri becomes jealous of Mozart through his achievement of being a musician, superior quality and of course the skills Mozart holds within. From reading the end of the play of Act 1, Mozartââ¬â¢s talents and lifestyle cause Salieri to take revenge on God for many reasons. Throughout the play, one of the reasons why Salieri took revenge on God because of Mozart is the fact that Mozart is a child who was born as a prodigy. He was an individual who was gifted beyond the means of an average child. According to the play, the Venticelli I and II stated that ââ¬Å"Wolfgang Amadeus Mozart wrote his first symphony at five. He did his first concert at four and a full opera at fourteen (I. 3. 20-21). â⬠That has a lot to say about Mozart because at that young age he had achieved something great, and as they would say he was born as a gifted individual, a prodigy. Therefore, he felt that there was someone out there that might have been better than or as good as him in Europe. Another reason why Mozartââ¬â¢s talents and lifestyle cause Salieri to take revenge on God is the fact that Mozart had an affair with a pupil of Salieri, her name Katherina Cavalieri. The reason that Salieri became furious himself because he tried to get with Katherina Cavalieri, Salieri quoted ââ¬Å"I was very much in love with Katerina or at least a lust (I. 3. 19)â⬠. However, that didnââ¬â¢t happen because he made a bargain with God. Which clearly states, ââ¬Å"Signore, let me be a composer! Grant me sufficient fame to enjoy it. In return, I will live with virtue. I will strive to better the lot of my fellows. And I will honor you with much music all the days of my life! (I. 2. 16. 17)â⬠. Antonio Salieri became envy of Mozart because he took Katherina Cavelieri into bed. Depicted from the play by Shaffer, Constanze quoted ââ¬Å"He doesnââ¬â¢t drag them into bed! (I. 10. 48)â⬠. This was also another reason why he envied Mozart, hated him and as well later in the play took out his anger on God. Lastly, another reason is when Salieri took the manuscripts from Mozart because it holds greatness. It was the original copy of Mozartââ¬â¢s genius work, quoted ââ¬Å"She said that these were his original scores (I. 12. 57). In addition, it was quoted ââ¬Å"Then suddenly he snatches it, tears the ribbon, and opens the case and stares greedily at the manuscripts within (I. 12. 57). â⬠This was one of the biggest reasons why he envied Mozart as a person because it takes him one try to complete his music and as for himself it takes long hours and days to complete one of his own wo rks, which may or may not be compared to Mozartââ¬â¢s pure genius work. In conclusion, the opening quote of the play is meant for the hatred of Mozart. It states, ââ¬Å"Spiteful, sniggering, conceited, infantine Mozart who has never worked one minute to help another man! I. 12. 59). â⬠The reasons stated in the previous paragraphs were examples of the fact that Salieri envied and hated Mozart, as well as taken it out on God because he feels that he was betrayed by God in way that he didnââ¬â¢t do anything about destroying Mozart who in fact is making Salieriââ¬â¢s, life a bit more frustrating, when in fact he made a bargain with God and did everything he promised, and God does this. Therefore, he Salieri implied ââ¬Å"Iââ¬â¢ll tell you about the war I fought with God through his preferred Creature-Mozart, name Amadeus, The creature had to be destroyed (I. 12. 60). ââ¬
Tuesday, October 8, 2019
What was the larger strategic significance of the failure of the Essay
What was the larger strategic significance of the failure of the Gallipoli expedition 1915-1916 - Essay Example The result was a huge loss of manpower and resources on both the sides. The Gallipoli Expedition also known popularly as the "Dardanelles operation of 1915" is regarded as one of the major failure for the Allied forces in World War I. It affected both the Central powers as well as the Entente alike. Several lessons were learned from the expedition with the most important of them being the following Trust the instincts and act with common sense as the situation prompts while planning the attacks instead of following the bookish lessons. Trust the war tactics and the people instead of depending on the technology completely Archaic titles and birth privileges are just not enough to win the military war, but merit and true valour. The Dardanelles expedition influenced the politics of the European nations as well as the Middle East countries in many different ways. The larger strategic significance gained from the failure of the Gallipoli expedition in 1915-1916 led the Entente to reform their war tactics and win the World War I. The failure came as a hit to the Anglo-French coalition's pride. The blow awakened them literally from falling into disaster practicing their traditional war strategies. On the other hand it led to major reforms in countries like Turkey opening the gates of the democracy in the Middle East. The Gallipoli Expedition The Gallipoli expedition was fought between the Ottoman Empire and the Western nations. The Anglo-French armies were largely assisted by nations like New Zealand and Australia. ANZAC or the Australia and New Zealand Army Corps played a major role in the campaign. The Entente were headed by General Sir Ian Hamilton and the Ottoman Turks were led by Kemal Pasha Ataturk. It is important to explore the reason behind the origin of the World War if we have to understand the importance of the Dardanelles expedition. The Archduke Franz Ferdinand of Australia and his wife Sophie were murdered by Serbian terrorists on 28th June 1914. Serbi a was an independent state but was annexed by the Austria in 1908 amidst great protests. The prince's ideas of reforms were quite unpopular among the elite as well the freedom movements in Serbia. There were several nationalistic movements in the country which feared the Serbs might be repressed further by the reforms as the Prince Ferdinand was next in line to throne. Hence they carried out the assassination which triggered many long standing disputes between the various major European powers. The World War I termed as the 'Great War' took nearly 20 million lives and left more than 21 million wounded (Fromkin, 1989). The causes for the origin of the war were much debated and its effects were felt for a long time in the world. Historians like Wolfgang Mommsen analyzed various reasons for the German uprising and termed it was a measure to divert the public from other issues like inequality created due to industrialization, democratization and the other core issues the average German citizen had started to question his rulers (Keiger, 1983). Each country in Europe was influenced by a different principle starting from militarism to imperialism and nationalism. Each was in direct conflict with the other. The assassination of the Archduke made them take sides. Major military Powers like the Great Britain, France and Russia joined hands on one side forming the Entente while the Germany, Austria and Hungary along with other small nations joined together on the opposite side forming the Central Powers.1 The growing power of Germany alarmed both its eastern and western neighbours the Russia and France. Hence, they formed an alliance together with the Great Britain to defend
Subscribe to:
Posts (Atom)