Skip to main content

Dmitry Serebrennikov's Library tagged java   View Popular

29 May 09

Hibernate Querying 101 : tips and tricks

      1. Use an optimised HQL query to return only the columns you
        really need.




      Generally, the first option isn't greatly appreciated by the client. So
      lets look at the second option. This approach involves determining exactly
      which columns you really need, and instanciating data-transfer JavaBean objects
      containing exactly those columns.

      select new CityItem(city.id, city.name, city.electrityCompany.name)
      from City city
      ...



      This technique is fast and efficient, and avoids the overheads of handling
      associated objects and of loading large numbers of persistent objects
      into the Hibernate session cache. The only downside is the need to create
      a dedicated data-transfer class for each query.

28 May 09

InfoQ: Structured Event Streaming with Smooks

More on smooks 1.1. Current version is 1.2 - keep in mind.

www.infoq.com/...event-streaming-with-smooks - Preview

smooks java xml

  • Smooks works by converting a stream of structured/hierarchical data into a stream of "events" that can then be targeted with "Visitor Logic" for analysis, or to produce a result (optional).
  • Create and populate Java Object models/graphs from any of the supported data formats (i.e. not just XML), in a standard way. 
  • 1 more annotations...

Main Page - Smooks

Interesting - java-to-java transformations, validations simple and business-rule-based, persistence "cartridge" with JPA support.

www.smooks.org/...index.php - Preview

xml java

Chapter 8. Marshalling XML using O/X Mappers

Spring has support for marshaling/unmarshaling. Go figure. "Of course it's in Spring!"

static.springsource.org/...oxm.html - Preview

spring xml java

  • Ease of configuration. 
    Spring's bean factory makes it easy to configure marshallers, without needing to construct JAXB context,
    JiBX binding factories, etc. The marshallers can be configured as any other bean in your application
    context. Additionally, XML Schema-based configuration is available for a number of marshallers, making
    the configuration even simpler.

    Consistent Interfaces. 
    Spring's O/X mapping operates through two global interfaces: the
    Marshaller and Unmarshaller interface.
    These abstractions allow you to switch O/X mapping
    frameworks with relative ease, with little or no changes required on the classes that do the
    marshalling. This approach has the additional benefit of making it possible to do XML marshalling with
    a mix-and-match approach (e.g. some marshalling performed using JAXB, other using XMLBeans) in a
    non-intrusive fashion, leveraging the strength of each technology.

    Consistent Exception Hierarchy. 
    Spring provides a conversion from exceptions from the underlying O/X mapping tool to its own exception
    hierarchy with the XmlMappingException as the root exception. As can be expected,
    these runtime exceptions wrap the original exception so no information is lost.

  • <oxm:jaxb2-marshaller id="marshaller" contextPath="org.springframework.ws.samples.airline.schema"/>

  • 5 more annotations...
1 - 20 of 58 Next › Last »
Showing 20 items per page

Diigo is about better ways to research, share and collaborate on information. Learn more »

Join Diigo