Skip to main content

Home/ Java Development/ Group items tagged jpa

Rss Feed Group items tagged

Hendy Irawan

Getting started with Spring Data JPA | SpringSource Team Blog - 0 views

  •  
    As we have just released the first milestone of the Spring Data JPA project I'd like to give you a quick introduction into its features. As you probably know, the Spring framework provides support to build a JPA based data access layer. So what does Spring Data JPA add to this base support? To answer that question I'd like to start with the data access components for a sample domain implemented using plain JPA + Spring and point out areas that leave room for improvement. After we've done that I will refactor the implementations to use the Spring Data JPA features to address these problem areas. The sample project as well as a step by step guide of the refactoring steps can be found on Github.
Terry Trippany

JPA with Rational Application Developer 8 and WebSphere Application Server 8 - 0 views

  •  
    JPA with RAD8
Hendy Irawan

Why doesn't (JPA, JMS, JTA, EJB, JSF, CDI) work? JEE is "Too Complicated" | OcpSoft - 0 views

  •  
    "Stop using Tomcat and wondering why JEE "doesn't work." You're doing yourself a big disservice. Start thinking about JBoss AS 6, or GlassFish v3 - Yes, I know, it's a "Full JEE Container," - it's "Heavy," but with JEE6, that's not a bad thing: It all "Just works" and it works really well. Trust me, the reason people have thought Java EE sucks, is because they try to do this stuff on Tomcat, and say "Why doesn't (JPA, JMS, JTA, EJB, JSF, CDI) work?" Well… that's because Tomcat only gives you Servlet - the Request/Response lifecycle. So people install all these things manually, or try to, and then say, "Wow, Java EE is really hard to use, shit, I'm gonna use Spring or Grails instead.""
Paul Sydney Orozco

How to Add CRUD Capability On Spring MVC using Hibernate JPA - 0 views

  •  
    A step by step tutorial on adding CRUD (Create,Read,Update,Delete) capability on Spring MVC using Hibernate JPA.
anonymous

Getting Started with RequestFactory - Google Web Toolkit - Google Code - 0 views

  • Entity Proxies
    • anonymous
       
      Proxy type (on the Client) vs Entity type (on the server)
  • proxy types
  • entity types
  • ...147 more annotations...
  • methods that return service stubs
  • one RequestFactory interface for your application
  • employeeRequest();
  • @Service(Employee.class)
  • extends RequestContext
  • extends RequestFactory
  • service stub
  • RequestFactory service stubs
  • must extend RequestContext
  • The methods in a service stub do not return entities directly
  • return subclasses of com.google.gwt.requestfactory.shared.Request.
  • This allows the methods on the interface to be invoked asynchronously with
  • Request.fire()
  • fire(    new Receiver()
  • onSuccess
  • callers pass an AsyncCallback that implements onSuccess()
  • takes a Receiver which must implement onSuccess()
  • Receiver is an abstract class having a default implementation of onFailure()
  • you can extend Receiver and override onFailure()
  • onViolation()
  • any constraint violations on the server
  • The Request type returned from each method
  • parameterized with the return type of the service method.
  • Methods that have no return value should return type Request<Void>
  • BigDecimal, BigInteger, Boolean, Byte, Enum, Character, Date, Double, Float, Integer, Long, Short, String, Void
  • subclass of EntityProxy
  • List<T> or Set<T>
  • primitive types are not supported
  • methods that operate on an entity itself
  • like persist() and remove()
  • return objects of type InstanceRequest rather than Reques
  • Server Implementations
  • methods defined in an
  • entity's service interface
  • implemented in the class named
  • @Service annotation
  • in these examples, is the entity class
  • service implementations do not directly implement the RequestContext interface
  • server-side implementations use the domain entity types
  • @Entity
  • EntityManager
  • createQuery
  • getResultList();
  • entityManager()
  • createEntityManager()
  • em.persist(this);
  • em.remove(attached
  • em.close();
  • defined in the service's
  • RequestContext interface
  • even though the implementation does not formally implement the interface in Java
  • name and argument list for each method
  • same on client and server
  • Client side methods
  • return Request<T>
  • only T on the server
  • EntityProxy types become the domain entity type on the server
  • Methods that return a Request object in the client interface are implemented as static methods on the entity
  • Methods that operate on a single instance of an entity, like persist() and remove(),
  • eturn an
  • InstanceRequest
  • in the client interface
  • Instance methods do not pass the instance directly, but rather via the
  • using()
  • instance methods must be implemented as non-static methods in the entity type
  • Four special methods are required on all entities
  • as they are used by the RequestFactory servlet:
  • constructor
  • findEntity
  • An entity's getId()
  • is typically auto-generated by the persistence engine (JDO, JPA, Objectify, etc.)
  • "find by ID" method has a special naming convention
  • find()
  • "find" plus the type's simple name
  • On the server
  • getVersion() method is used by RequestFactory to infer if an entity has changed
  • backing store (JDO, JPA, etc.) is responsible for updating the version each time the object is persisted,
  • RequestFactoryServlet sends an UPDATE
  • if an entity changes as
  • Second, the client maintains a version cache of recently seen entities
  • Whenever it sees an entity whose version has changed, it fires
  • UPDATE events on the event bus
  • so that listeners can update the view
  • GWT.create
  • and initialize it with your application's EventBus
  • GWT.create
  • requestFactory.initialize
  • create a new entity on the client
  • EmployeeRequest request
  • EmployeeProxy newEmployee
  • All client-side code should use the EmployeeProxy
  • not the Employee entity itself
  • unlike GWT-RPC, where the same concrete type is used on both client and server
  • RequestFactory
  • designed to be used with an ORM layer like JDO or JPA
  • on the server
  • to build data-oriented (CRUD) apps with an ORM-like interface
  • on the client
  • easy to implement a data access layer
  • structure your server-side code in a data-centric way
  • GWT-RPC, which is service-oriented
  • On the client side, RequestFactory keeps track of objects that have been modified and sends only changes
  • lightweight network payloads
  • solid foundation for automatic batching and caching of requests in the future
  • RequestFactoryServlet
  • RequestFactory uses its own servlet
  • own protocol
  • not designed for general purpose services like GWT-RPC
  • implements its
  • It is designed specifically for implementing a persistence layer on both client and server.
  • In persistence frameworks like JDO and JPA, entities are annotated with
  • client-side representation of an entity
  • known as a
  • DTO (Data Transfer Object)
  • hook used to indicate that an object can be managed by RequestFactory
  • RequestFactory
  • EntityProxy interface
  • automatically populates bean-style properties between entities on the server and the corresponding EntityProxy on the client,
  • send only changes ("deltas") to the server
  • extends EntityProxy
  • interface
  • @ProxyFor
  • reference the server-side entity being represented
  • It is not necessary to represent every property and method from the server-side entity in the EntityProxy
  • EntityProxyId returned by this method is used throughout RequestFactory-related classes
  • while getId() is shown in this example, most client code will want to refer to
  • EntityProxy.stableId() i
  • to represent any type
  • is not required to expose an ID and version
  • often used to represent embedded object types within entities
  • @Embedded
  • Address
  • Address type
  • POJO with no persistence annotations
  • Address is represented as a ValueProxy
  • extends ValueProxy
  • interface
  • extends EntityProxy
  • interface
  • AddressProxy
  • AddressProxy
  • ValueProxy can be used to pass any type to and from the server
  • RequestFactory
  • interface between your client and server code
  • RequestContext interface
  • The server-side service
  • must implement each method
Hendy Irawan

Texo - Eclipsepedia - 0 views

  •  
    "Texo provides JPA annotations, model and template driven development technology powered by EMF for web application (WAR) development projects. Texo uses components currently present in the Eclipse Modeling Framework (EMF) and Eclipse Modeling Framework Technology (EMFT) projects. Texo is a proposed open source component in the Eclipse Modeling Framework Technology (EMFT) project. "
Hendy Irawan

Querydsl - 0 views

  •  
    Querydsl is a framework which enables the construction of type-safe SQL-like queries for multiple backends including JPA, JDO and SQL in Java. Instead of writing queries as inline strings or externalizing them into XML files they are constructed via a fluent API. Code completion in IDE (all properties, methods and operations can be expanded in your favorite Java IDE) Almost no syntactically invalid queries allowed (type-safe on all levels) Domain types and properties can be referenced safely (no Strings involved!) Adopts better to refactoring changes in domain types Incremental query definition is easier Querydsl is licensed under the LGPL 2.1 license.
anonymous

A beginner's guide to JPA and Hibernate Cascade Types | Vlad Mihalcea's Blog - 0 views

  • Cascading only makes sense only for Parent – Child associations (the Parent entity state transition being cascaded to its Child entities). Cascading from Child to Parent is not very useful and usually, it’s a mapping code smell.
Hendy Irawan

Java EE 6 and Scala » Source Allies Blog - 0 views

  •  
    Last weekend while pondering the question "Is Scala ready for the enterprise?" I decided to write a simple Java EE 6 app entirely in Scala, without using any Java. I had three main reasons for doing this: one was just to see how easy/difficult it would be to write everything in Scala (it was easy).  Another was to document the process for others journeying down the same road (the entire project is on github).  Finally, I wanted to identify advantages of using Scala instead of Java that are specific to Java EE apps (I found several). Background The specific app I created was an adaptation of the Books example from Chapter 10 of Beginning Java™ EE 6 Platform with GlassFish™ 3. It's a simple web app that displays a list of books in a database and lets you add new books. Although it's a pretty trivial app, it does touch on several important Java EE 6 technologies: JPA 2.0, EJB 3.1 and JSF 2.0.
DJHell .

Hades - Übersicht - redmine.synyx.org - 0 views

  •  
    Hades is a utility library to work with Data Access Objects implemented with Spring and JPA. The main goal is to ease the development and operation of a data access layer in application
abuwipp

Spring to Java EE - A Migration Experience | OcpSoft - 0 views

  •  
    Does it all make sense now? Do you know how to solve every problem? Probably not, but when it comes right down to it, using Java EE can be even simpler than using Spring, and take much less time. You just have to find the right guides and the right documentation (which is admittedly a severe sore-spot of Java EE; the documentation is still a work in progress, but is getting much better, save blogs like this one.) You have to turn to a vendor like JBoss, or IBM in order to get the use-case driven documentation you need, and they do have documentation, it's just a matter of finding it. Seam 3 in particular strives to give extensive user-documentation, hopefully making things much simpler to adopt, and easier to extend. The main purpose of this article was not to bash Spring, although I may have taken that tone on occasion just for contrast and a little bit of fun. Both Spring and Java EE are strongly engineered and have strong foundations in practical use, but if you want a clean programming experience right out of the box - use Java EE 6 on JBoss Application Server 6 - JBoss Tools - and Eclipse. I will say, though, that the feeling I've gotten from the Spring forums vs the Java EE forums, is that there are far many more people willing to help you work through Java EE issues, and more available developers of the frameworks themselves to actually help you than there are on the Spring side. The community for Java EE is much larger, and much more supportive (from my personal experience.) In the end, I did get my application migrated successfully, and despite these issues (from which I learned a great deal,) I am still happy with Java EE, and would not go back to Spring! But I do look forward to further enhancements from the JBoss Seam project, which continue to make developing for Java EE simpler and more fun. Don't believe me? Try it out. Find something wrong? Tell me. Want more? Let me know what you want to hear.
Hendy Irawan

Seam Framework - Persistence Module Home - 0 views

  •  
    " Brings transactions and persistence to managed beans, provides a simplified transaction API and hooks transaction propagation events to the CDI event bus."
Hendy Irawan

Java Tips - Inheritance and the Java Persistence API - 0 views

  •  
    "This Tech Tip presents some of the features of inheritance supported in the Java Persistence API. A sample package accompanies the Tech Tip. It demonstrates some of the features discussed in the tip. The examples in the tip are taken from the source code for the sample (which is included in the package). The sample uses an open source reference implementation of Java EE 5 called GlassFish. You can download GlassFish from the GlassFish Community Downloads page."
anonymous

InfoQ: Revving Up Your Hibernate Engine - 1 views

  •  
    Tuning Hibernate
1 - 18 of 18
Showing 20 items per page