Skip to main content

Home/ SoftwareEngineering/ Group items matching "transactions" in title, tags, annotations or url

Group items matching
in title, tags, annotations or url

Sort By: Relevance | Date Filter: All | Bookmarks | Topics Simple Middle
kuni katsuya

Java Persistence/Transactions - Wikibooks, open books for an open world - 0 views

  • JTA transactions are
  • implicitly defined through SessionBean usage/methods. In a SessionBean normally each SessionBean method invocation defines a JTA transaction.
  • JTA Transactions
  • ...10 more annotations...
  • In JEE managed mode, such as an EntityManager injected into a SessionBean, the EntityManager reference, represents a new persistence context for each transaction. This means objects read in one transaction become detached after the end of the transaction, and should no longer be used, or need to be merged into the next transaction. In managed mode, you never create or close an EntityManager.
  • Transactions
  • operations that are committed or rolled back as a single unit
  • JPA provides two mechanisms for transactions
  • JTA (Java Transaction API
  • EntityTransaction
  • all changes made to all persistent objects in the persistence context are part of the transaction.
  • Nested Transactions
  • do not support nested transactions
  • JPA and JTA
kuni katsuya

Transactional Interceptors (Linda DeMichiel's Blog) - 0 views

kuni katsuya

Comparing JSF Beans, CDI Beans and EJBs | Andy Gibson - 0 views

  • differences between CDI beans and EJBs is that EJBs are : Transactional Remote or local Able to passivate stateful beans freeing up resources Able to make use of timers Can be asynchronous
  • Stateless EJBs can be thought of as thread safe single-use beans that don’t maintain any state between two web requests
  • Stateful EJBs do hold state and can be created and sit around for as long as they are needed until they are disposed of
  • ...15 more annotations...
  • Stateless beans must have a dependent scope while a stateful session bean can have any scope. By default they are transactional, but you can use the transaction attribute annotation.
  • CDI beans can be injected into EJBs and EJBs can be injected into CDI beans
  • When to use which bean How do you know when to use which bean? Simple.
  • In general, you should use CDI beans unless you need the advanced functionality available in the EJBs such as transactional functions. You can write your own interceptor to make CDI beans transactional, but for now, its simpler to use an EJB until CDI gets transactional CDI beans which is just around the corner
  • Comparing JSF Beans, CDI Beans and EJBs
  • JSF Managed Beans
  • In short, don’t use them if you are developing for Java EE 6 and using CDI. They provide a simple mechanism for dependency injection and defining backing beans for web pages, but they are far less powerful than CDI beans.
  • JSF beans cannot be mixed with other kinds of beans without some kind of manual coding.
  • CDI Beans
  • includes a complete, comprehensive managed bean facility
  • interceptors, conversation scope, Events, type safe injection, decorators, stereotypes and producer methods
  • JSF-like features, you can define the scope of the CDI bean using one of the scopes defined in the javax.enterprise.context package (namely, request, conversation, session and application scopes). If you want to use the CDI bean from a JSF page, you can give it a name using the javax.inject.Named annotation
  • Comparing JSF Beans, CDI Beans and EJBs
  • Comparing JSF Beans, CDI Beans and EJBs
  • JSF Managed Beans
kuni katsuya

Enterprise JavaBeans 3.1 with Contexts and Dependency Injection: The Perfect Synergy - 0 views

  • stateless EJB 3.1 bean as boundary (Facade)
  • injected managed beans (controls)
  • @Inject
  • ...22 more annotations...
  • @Inject
  • CDI managed beans. The @EJB annotation is removed and @Inject is used instead
  • Annotating the boundary (Cart) with the @Named annotation makes the Cart immediately visible for expression language (EL) expressions in JSP and JSF
  • @Named annotation takes the simple name of the annotated class, puts the first character in lowercase, and exposes it directly to the JSF pages (or JSP). The Cart bean can be accessed directly, without any backed or managed beans, by the JSF pages: <h:commandButton value="Check out!" action="#{cart.checkout}" />
  • If there is a need for abstraction, the class can be turned into an interface (or abstract class)
  • local implementation (with CDI events
  • @Inject Event<String> event;
  • event.fire("Order proceeded!");
  • remote implementation:
  • javax.enterprise.event.Event belongs to the CDI-implementation
  • class Event can be considered to be a lightweight alternative to the java.beans.PropertyChangeSupport class
  • @Inject Event<String> event;
  • event.fire("Order proceeded!");
  • event can be received by any managed bean and also by EJB beans
  • provide a method with a single @Observes annotated parameter
  • @Observes String event
  • there is no real event, just the payload:
  • The during attribute in the @Observes annotation allows you to select in which transactional phase the event gets delivered. The default setting is IN_PROGRESS, which causes an immediate event delivery regardless of the transaction outcome. The AFTER_SUCCESS configuration causes the delivery to occur only after successful transaction completion
  • Although CDI events work only inside a single process (in the default case, CDI is extensible), they are perfectly suitable for decoupling packages from modules
  • The method checkout() starts a transaction that gets "reused" by the OrderSystem and CustomerNotification session beans
  • ordering.placeOrder(); notifier.sendNotification();
    • kuni katsuya
       
      both run within same transaction
  • EJB beans cannot be directly exposed to JSF or JSP without a little help from CDI
kuni katsuya

Java Persistence/Advanced Topics - Wikibooks, open books for an open world - 0 views

  • Events
  • hook into a system that allows the execution of some code when the event occurs
  • JPA defines several events for the persistent
  • ...37 more annotations...
  • life-cycle
  • of Entity objects
  • JPA defines the following events:
  • PostLoad
  • PrePersist
  • PostPersist
  • PreUpdate
  • PostUpdate
  • PreRemove
  • PostRemove
  • after an Entity is loaded into the
  • persistence context
  • before the persist operation is invoked on an Entity
  • after a refresh operation.
  • before the remove operation is invoked on an Entity
  • cascade of a remove operation
  • during a flush or commit for orphanRemoval in JPA 2.0
  • after an instance is deleted from the database
  • occurs during a flush or commit operation
  • after the database DELETE has occurred
  • before the transaction is committed
  • after an instance is updated in the database
  • occurs during a flush or commit operation
  • after the database UPDATE has occurred
  • before the transaction is committed
  • before an instance is updated in the database
  • occurs during a flush or commit operation
  • after the database UPDATE has occurred
  • before the transaction is committed
  • after a new instance is persisted to the database
  • occurs during a flush or commit operation
  • after the database INSERT has occurred
  • before the transaction is committed
  • Id of the object should be assigned
  • merge for new instances
  • cascade of a persist operation
  • Id of the object may not have been assigned, and code be assigned by the event
kuni katsuya

Java Persistence/Persisting - Wikibooks, open books for an open world - 0 views

  • Persist
  • used to insert a new object into the database
  • it just registers it as new in the persistence context (transaction)
  • ...6 more annotations...
  • Merge
  • When the transaction is committed, or if the persistence context is flushed, then the object will be inserted into the database
  • used to merge the changes made to a detached object into the persistence context
  • it merges the changes into the persistence context (transaction)
  • When the transaction is committed, or if the persistence context is flushed, then the object will be updated in the database.
  • merge is only required when you have a detached copy of a persistence object
kuni katsuya

Mirror/deltaspike at master · DeltaSpike/Mirror · GitHub - 0 views

  • CDI Extensions Project
  • best mature features of
  • JBoss Seam3
  • ...27 more annotations...
  • Apache MyFaces CODI
  • other CDI Extensions projects.
  • container agnostic
  • different containers get activated via
  • Maven Profiles
  • CDI container integration via
  • Arquillian
  • Building Apache DeltaSpike
  • DeltaSpike-0.3
  • Release Notes
  • [DELTASPIKE-62] - Discuss security module
  • [DELTASPIKE-74] - unit and integration tests for @Secured
  •  [DELTASPIKE-75] - documentation for @Secured
  • [DELTASPIKE-78] - review and discuss Authentication API
  •  [DELTASPIKE-77] - review and discuss Identity API
  • [DELTASPIKE-79] - review and discuss Authorization API
  • [DELTASPIKE-81] - review and discuss Identity Management
  • [DELTASPIKE-82] - review and discuss external authentication
  • [DELTASPIKE-176] - unit and integration tests for @Transactional
  • [DELTASPIKE-177] - documentation for @Transactional
  •  [DELTASPIKE-179] - unit and integration tests for @TransactionScoped
  • [DELTASPIKE-175] - @Transactional for EntityTransaction
  •  [DELTASPIKE-178] - @TransactionScoped
  •  [DELTASPIKE-190] - Create ConfigurableDataSource
  • [DELTASPIKE-219] - @Transactional for JTA UserTransaction
  • [DELTASPIKE-230] - Fallback stragtegy for resource bundles and locales
  •   [DELTASPIKE-223] - Add convention for @MessageResource annotated types.
kuni katsuya

JPA Reference Guide - JBoss AS 7.1 - Project Documentation Editor - 0 views

  • Troubleshooting The org.jboss.as.jpa logging can be enabled to get the following information: INFO - when persistence.xml has been parsed, starting of persistence unit service (per deployed persistence.xml), stopping of persistence unit service DEBUG - informs about entity managers being injected, creating/reusing transaction scoped entity manager for active transaction TRACE - shows how long each entity manager operation took in milliseconds, application searches for a persistence unit, parsing of persistence.xml
  • Container-managed Extended Persistence context
  • extended persistence context can
  • ...20 more annotations...
  • span multiple transactions
  • and allows data modifications to be queued up (like a shopping cart),
  • without an active JTA transaction
  • EXTENDED
  • entity lifecycle
  • is managed by the underlying persistence provider.
  • New (transient):
  • an entity is new if it has just been instantiated using the new operator, and it is not associated with a persistence context. It has no persistent representation in the database and no identifier value has been assigned.
  • Managed (persistent):
  • a managed entity instance is an instance with a persistent identity that is currently associated with a persistence context.
  • Detached:
  • the entity instance is an instance with a persistent identity that is no longer associated with a persistence context, usually because the persistence context was closed or the instance was evicted from the context.
  • Removed:
  • a removed entity instance is an instance with a persistent identity, associated with a persistence context, but scheduled for removal from the database.
  • Replacing the current Hibernate 4.0.x jars with a newer version
  • update the current as7/modules/org/hibernate/main folder
  • Delete *.index files in as7/modules/org/hibernate/main and as7/modules/org/hibernate/envers/main folders
  • Remove the older jars and copy new Hibernate jars into as7/modules/org/hibernate/main + as7/modules/org/hibernate/envers/main.
  • Update the as7/modules/org/hibernate/main/module.xml
  • as7/modules/org/hibernate/envers/main/module.xml to name the jars that you copied in.
kuni katsuya

Article Series: Migrating Spring Applications to Java EE 6 - Part 3 | How to JBoss - 0 views

  • Stateless Session Bean is transactional by default
  • In this article we will discuss migrating the DAO layer, AOP and JMX
  • Migrating JDBC templates
  • ...3 more annotations...
  • In general, JDBC Templates are a poor solution. They don’t have enough abstraction to work on different databases because you use plain SQL in queries. There is also no real ORM mapping which results in quite a lot of boilerplate code
  • SimpleJdbcTemplate(ds)
  • @InterceptorBinding
  •  
    Stateless Session Bean is transactional by default.
kuni katsuya

JBoss Developer Framework - 0 views

  • jta-crash-rec Crash Recovery, JTA Uses Java Transaction API and JBoss Transactions to demonstrate recovery of a crashed transaction
  • jts-distributed-crash-rec JTS Demonstrates recovery of distributed crashed components
  • cdi-injection CDI Demonstrates the use of CDI 1.0 Injection and Qualifiers with JSF as the front-end client.
  • ...13 more annotations...
  • bean-validation JPA, Bean Validation Shows how to use Arquillian to test Bean Validation
  • ejb-security Security, EJB Shows how to use Java EE Declarative Security to Control Access to EJB 3
  • payment-cdi-event CDI Demonstrates how to use CDI 1.0 Events
  • richfaces-validation RichFaces Demonstrates RichFaces and bean validation
  • ejb-in-war JSF, WAR, EJB Packages an EJB JAR in a WAR
  • greeter EJB, JPA, JSF, JTA, CDI Demonstrates the use of CDI 1.0, JPA 2.0, JTA 1.1, EJB 3.1 and JSF 2.0
  • helloworld-mdb EJB, MDB, JMS Demonstrates the use of JMS 1.1 and EJB 3.1 Message-Driven Bean
  • helloworld-rs JAX-RS, CDI Demonstrates the use of CDI 1.0 and JAX-RS
  • kitchensink BV, EJB, JAX-RS, JPA, JPA, JSF, CDI
  • servlet-async CDI, EJB, Servlet Demonstrates CDI, plus asynchronous Servlets and EJBs
  • servlet-security Security, Servlet Demonstrates how to use Java EE declarative security to control access to Servlet 3
  • shopping-cart EJB Demonstrates a stateful session bean
  • tasks Arquillian, JPA Demonstrates testing JPA using Arquillian
kuni katsuya

JPA Reference Guide - JBoss AS 7.0 - Project Documentation Editor - 0 views

  • Persistence unit properties
  • Should be hibernate3-bundled if Hibernate 3 jars are in the application archive (adapterModule and adapterClass will automatically be set for hibernate3-bundled).
  • org.jboss.as.jpa.hibernate:3 (Hibernate 3 integration classes)
  • ...14 more annotations...
  • jboss.as.jpa.adapterModule
  • jboss.as.jpa.adapterClass
  • org.jboss.as.jpa.hibernate3.HibernatePersistenceProviderAdaptor
  • Working with other persistence providers
  • A project to build integration for persistence providers like EclipseLink, is here.
  • Troubleshooting
  • “org.jboss.as.jpa” logging can be enabled to get the following information: INFO - when persistence.xml has been parsed, starting of persistence unit service (per deployed persistence.xml), stopping of persistence unit service DEBUG - informs about entity managers being injected, creating/reusing transaction scoped entity manager for active transaction TRACE - shows how long each entity manager operation took in milliseconds, application searches for a persistence unit, parsing of persistence.xml
  • To enable TRACE, open the as/standalone/configuration/standalone.xml (or as/domain/configuration/domain.xml) file. Search for <subsystem xmlns="urn:jboss:domain:logging:1.0"> and add the org.jboss.as.jpa category
  • Packaging the Hibernate 3.5 or greater 3.x JPA persistence provider with your application
  • jboss.as.jpa.providerModule needs to be set to hibernate3-bundled.
  • <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />
  • Sharing the Hibernate 3.5 or greater JPA persistence provider between multiple applications
  • Applications can share the same Hibernate3 (for Hibernate 3.5 or greater) persistence provider by manually creating an org.hibernate:3 module (in the AS/modules folder). Steps to create the Hibernate3 module:
  • <property name="jboss.as.jpa.providerModule" value="org.hibernate:3" />
kuni katsuya

Anemic domain model - Wikipedia, the free encyclopedia - 0 views

  • objects containing only data
    • kuni katsuya
       
      ie. dumb data structures with little or no behavior
  • objects containing only code
    • kuni katsuya
       
      ie. classes that are just containers for methods that implement the behavior part of the domain objects (aka the procedures)
  • Martin Fowler, who considers the practice an anti-pattern
  • ...14 more annotations...
  • Benefit
    • kuni katsuya
       
      none
  • Liabilities
    • kuni katsuya
       
      lots
  • Logic cannot be implemented in a truly object-oriented way
    • kuni katsuya
       
      for example, polymorphic behavior
    • kuni katsuya
       
      dammit, can't change highlight color if there's also a sticky note attached!!! arrgggghhhh!!! diigo plugin bug!!
  • Violation of the encapsulation
  • domain model's objects cannot guarantee their correctness
  • validation and mutation logic is placed somewhere outside
    • kuni katsuya
       
      instead of, say, attaching validation 'behavior' directly on, but still decoupled from domain classes themselves (eg. validation rule annotations on jpa entity beans)
    • kuni katsuya
       
      dammit, can't change highlight color if there's also a sticky note attached!!! arrgggghhhh!!! diigo plugin bug!!
  • Necessitates a service layer when sharing domain logic across differing consumers of an object model.
  • Makes a model less expressive and harder to understand.
  • Facilitates code duplication among transactional scripts and similar use cases, reduces code reuse.
  • Liabilities
  • Liabilities
  • Liabilities
  • Liabilities
  • Liabilities
kuni katsuya

Hibernate - 0 views

  • what-when-how In Depth Tutorials and Information
  • Understanding object/relational persistence (Hibernate)
  • Mapping persistent classes (Hibernate)
  • ...5 more annotations...
  • Mapping collections and entity associations (Hibernate)
  • Advanced entity association mappings (Hibernate)
  • Inheritance and custom types (Hibernate)
  • Domain models and metadata (Hibernate)
  • Transactions and concurrency (Hibernate)
kuni katsuya

JPA implementation patterns: Bidirectional assocations | Xebia Blog - 0 views

  • JPA implementation patterns: Bidirectional assocations
  • it gets interesting when we make this association bidirectional
  • But there is a catch!
  • ...2 more annotations...
  • if you run them within one transaction like the code below does, you will find that the item list while be empty:
  • to keep bidirectional associations in sync, JPA leaves more up to the developer.
kuni katsuya

From Spring to Java EE 6 - Java Code Geeks - 1 views

  • prototyped application was designed as a standalone pure Spring applicatio
  • Spring v3
  • analyzed the interest of switching to a Java EE 6
  • ...9 more annotations...
  • can we do in Java EE 6 everything we can do in Spring ? can we do that as easy as in Spring ?
  • yes we can !
  • I am still - a real Spring fanboy (which I, historically speaking, discovered after having been literally disgusted by EJB's 1.0)
  • Contexts & Dependency Injection Messaging Transaction management Web services
  • Spring has an outstanding JMS support
  • Conclusion
  • Arguing that things are in Spring much simpler, much lighter than in Java EE is not - more exactly, no more – true
  • booting really fast
  • From Spring to Java EE 6
kuni katsuya

Adobe - real time data streaming | Adobe LiveCycle Data Services ES3: Solutions - 0 views

  • BlazeDS
  • Java NIO high-performance messaging (thousands of clients per CPU) No Yes Real Time Messaging Protocol (RTMP) No Yes Data throttling No Yes Reliable communications
  • Managed remoting
  • ...6 more annotations...
  • Transaction (batch processing)
  • Data paging
  • Lazy loading (on demand)
  • Conflict resolution and synchronization
  • SQL adapter
  • Hibernate adapter No Yes "Fiber-aware" assembler No Yes Offline synchronization framework
kuni katsuya

Java EE wins over Spring « Bill the Plumber - 0 views

  • Spring is controlled by ONE COMPANY. It is not an independent open source organization like Apache. At least with Java EE there are multiple OPEN SOURCE implementations. How long before VMWare decides its $500 million investment needs to be recouped and they start charging for Spring in a big way? Don’t think it can happen? Think again…VMWare is in the same poor position BEA/WLS was against JBoss with Red Hat’s VM/Cloud tech eating away at VMWare’s margins. There is a much higher chance of them scrambling for revenue sources than Red hat ever being acquired by Oracle.
  • Core JavaServer Faces JSF 2.0 Cookbook JavaServer Faces 2.0, The Complete Reference EJB 3.1 Cookbook Enterprise JavaBeans 3.1 Beginning Java EE 6 with GlassFish 3 Java EE 6 with GlassFish 3 Application Server Java EE 6 Development With NetBeans 7 Real World Java EE Patterns Rethinking Best Practices Real World Java EE Night Hacks Dissecting the Business Tier
  • books about the different APIs of Java EE 6:
  • ...8 more annotations...
  • if you’ve heard Rod Johnson speak he is always adamant that Spring has replaced Java EE. Its good to see that his rhetoric is utter BS!
  • Sorry, even Spring MVC sucks as much balls as JSF does.
  • Java EE wins over Spring
  • CDI closed API hole
  • Application server started to get their act together with regards to boot time.  It started with Glassfish and ended with JBoss 7.  Both of which can boot in a matter of seconds.
  • Arquillian allows you to run your unit tests in a real environment with real transactions, etc.  Personally I always despised mocks because they didn’t test in the environment you were going to run in.  I thought they were pointless and to this day, I refuse to use this testing pattern.
  • I’m glad Rod and company were able to cash out with the VMWare acquisition before Java EE was able to regain its dominance
  • SpringSource pushed Java EE to innovate and for that I’m very grateful.  For Java EE, it was either evolve or die.  They evolved, now its time for Spring to die.
1 - 20 of 35 Next ›
Showing 20 items per page