Hybris Tutorial

Introduction

Hybris brings a comprehensive software solution for the growing need of data management as the volume of product information continues to explode in the ecommerce business. Basic information - such as price, item number and short descriptions - is today being supplemented by detailed views, 3D animations, and comprehensive product text. In addition, Ecommerce businesses have to manage shorter product lifecycles, growing numbers of products, international markets and new sales channels which has been abundantly resolved through Hybris Commerce and Hybris Print solution.

Hybris Product Packages

Hybris comes with three main packages and each package can have extensions.
Main packages are

1. Product Information Module

2. Hybris Commerce

2. Hybris Print

JaloSession

The JaloSession is a core concept of the hybris Suite. A JaloSession wraps up data about the current user and their settings. It forms a context in which the hybris Suite processes user-specific requests. Every request from a web browser to the hybris Suite is associated with a JaloSession. But also hybris Suite CronJobs run in a JaloSession.

About Jalo Sessions

1. JaloSession's User

2. JaloSession's Language

3. JaloSession's Currency

4. JaloSession's Pricefactory

5. JaloSession's Locale

6. JaloSession's Timezone

During the JaloSession's instantiation, the SessionContext is pre-set with system defaults, which depend on the current tenant. The factory default user account is anonymous.
To access the JaloSession assigned to a thread, call the static JaloSession.getCurrentSession() method. This method will
return the currently active JaloSession
create a new JaloSession if none is currently active

Characteristics

There is always one JaloSession active for a given thread

JaloSession objects are held in memory only, they are not made persistent (written into the database). The JaloSession class implements the Serializable interface so that JaloSession objects could be transferred across application server nodes within a hybris Suite cluster.

Being non-persistent, creating and removing JaloSessions is a quick process. However, as JaloSession objects are not made persistent, a JaloSession cannot be recovered once it has been deactivated. A JaloSession that has timed out or that has been deactivated cannot be restored.

Although a JaloSession holds a reference to a Cart, the Cart is not actually instantiated along with the JaloSession. Unlike JaloSessions, Carts are made persistent (written into the database). Due to the database access, creating a Cart is slower than creating a JaloSession. Therefore, the hybris Suite only instantiates the JaloSession's when the Cart is actually addressed via the JaloSession class' getCart() method.

Calling the getCart() method therefore instantiates the Cart associated with the JaloSession, and – by consequence – is a rather slow process. To find out whether or not a JaloSession has a Cart, call the JaloSession class' hasCart() method. Please also refer to the Project Tips and Pitfalls - Best Practices document.

like HttpSession or EJB Session beans State objects that holds state between calls

For web application use, a JaloSession can be assigned to an HTTP session via the httpSession attribute. See also the documentation on Transparent HTTP Session Failover

2. "Externally" via Java Servlet filters, such as the HybrisInitFilter. The hybris Suite automatically creates a JaloSession when a web browser connects to a Java Servlet filter in the hybris Suite.

3. "Implicitly" by using a JaloSession without explicit instantiation, such as

JaloSession js = getSession();

final JaloSession session = JaloSession.getCurrentSession();

4. Via the hybris Suite's session cache
By specifying the sessionID (basically the PK) of a JaloSession, you can activate a given JaloSession. However, you cannot switch to JaloSessions that have timed out or have been closed or deactivated – not even with the sessionID