Monday, August 29, 2011

Spring Security 3 Implementation

Create a user adapter class. UserDetailsAdapter.java

public class UserDetailsAdapter extends org.springframework.security.core.userdetails.User {

private final Long id;
private static List useTypes = new ArrayList();

public UserDetailsAdapter(ServerAdmin userEntity) {
super(userEntity.getWebLoginId(), userEntity.getWebpassword(), userEntity.isWebLoginEnabled(), true, true, true, toAuthorities(userEntity.getAuthorities()));
this.id = userEntity.getId();
}

private static Collection toAuthorities(List authorities) {
Collection authorityList = new ArrayList();
for (String authority : authorities) {
authorityList.add(new GrantedAuthorityImpl(authority));
}
return authorityList;
}

public Long getId() {
return id;
}

}


Create UserDetailsServiceManager which implements UserDetailsService of Spring Security

@Service("userDetailsService")
public class UserDetailsServiceManager implements UserDetailsService {
private DAOFactory daoFactory;

@Transactional(readOnly = true)
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
UserDetails userDetails = null;
ServerAdmin userEntity = daoFactory.getServerAdminDAO().findByWebLoginId(username);
if (userEntity == null) {
throw new UsernameNotFoundException("user not found");
}

userDetails = new UserDetailsAdapter((ServerAdmin) userEntity);
return userDetails;
}

/**
* default constructor
*/
public UserDetailsServiceManager() {
}

public UserDetailsServiceManager(DAOFactory daoFactory) {
this.daoFactory = daoFactory;
}

@Autowired
public void setDaoFactory(DAOFactory daoFactory) {
this.daoFactory = daoFactory;
}
}



create the applicationContext-Security.xml. add the following code:




<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.3.xsd">

<!-- HTTP security configurations -->
<http auto-config="true" use-expressions="true">
<form-login login-processing-url="/resources/j_spring_security_check" login-page="/login"
authentication-failure-url="/login?login_error=t"/>
<logout logout-url="/logout"/>
<remember-me/>
<!-- Configure these elements to secure URIs in your application -->
<intercept-url pattern="/coupon/**" access="hasRole('ROLE_SERVERADMIN')"/>
<intercept-url pattern="/resources/**" access="permitAll"/>
<intercept-url pattern="/**" access="permitAll"/>
<!--
Uncomment to enable X509 client authentication support
<x509 />
-->
<!-- Uncomment to limit the number of sessions a user can have -->
<!--
<session-management invalid-session-url="/timeout.jsp">
<concurrency-control max-sessions="1" error-if-maximum-exceeded="true"/>
</session-management>
-->
</http>

<!-- Configure Authentication mechanism -->
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="userDetailsService">
<password-encoder ref="passwordEncoder">
<salt-source ref="saltSource"/>
</password-encoder>
</authentication-provider>
</authentication-manager>

<!-- For hashing and salting user passwords -->
<beans:bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"/>
<beans:bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource"
p:userPropertyToUse="id"/>
</beans:beans>


Wednesday, June 1, 2011

Time to Move Out!!!!!

The major reasons for me to move out was

1. Money
2. Career Growth
3. Reducing Traveling time.
4. No Challenging work.

Friday, April 1, 2011

Merging of devGoldCard branch to trunk

svn merge -r 8153:HEAD http://svn.lbi.co.uk/SVN/ToysRUs/Website/tru/branches/devGoldCard --dry-run

--- Merging r8154 through r8669 into '.':
A hybris/extensions/BBFConfig/resources/config/configservice/prod/uk.hybris.projects.tru.integration.giwebservice.service.GIWebService.config.properties
U hybris/extensions/BBFConfig/resources/config/configservice/truconfigservicelocator.xml
A hybris/extensions/BBFConfig/resources/config/configservice/neow
A hybris/extensions/BBFConfig/resources/config/configservice/neow/uk.hybris.projects.tru.config.core.ConfigCategoryService.config.xml
A hybris/extensions/BBFConfig/resources/config/configservice/neow/uk.hybris.projects.tru.core.email.EmailService.config.properties
A hybris/extensions/BBFConfig/resources/config/configservice/neow/uk.hybris.datacash.paypal.service.psp.PayPalPaymentServiceProvider.config.properties
A hybris/extensions/BBFConfig/resources/config/configservice/neow/uk.hybris.projects.tru.core.config.SystemPropertiesService.config.properties
A hybris/extensions/BBFConfig/resources/config/configservice/neow/uk.hybris.datacash.service.psp.PaymentServiceProvider.config.properties
C hybris/extensions/BBFConfig/resources/config/configservice/uat/uk.hybris.projects.tru.core.email.EmailService.config.properties
A hybris/extensions/BBFConfig/resources/config/configservice/uat/uk.hybris.projects.tru.integration.giwebservice.service.GIWebService.config.properties
A hybris/extensions/BBFConfig/resources/config/configservice/dev/uk.hybris.projects.tru.integration.giwebservice.service.GIWebService.config.properties
U hybris/extensions/TRUWebCommon/src/uk/hybris/projects/tru/web/common/beans/TruAddressBean.java
U hybris/extensions/TRUWebCommon/src/uk/hybris/projects/tru/web/common/beans/AbstractCustomerBean.java
U hybris/extensions/TRUWebCommon/src/uk/hybris/projects/tru/web/common/beans/TruCustomerBean.java
U hybris/extensions/TRUWebCommon/src/uk/hybris/projects/tru/web/common/beans/AbstractOrderBean.java
U hybris/extensions/TRUWebCommon/src/uk/hybris/projects/tru/web/common/beans/AddressSearchBean.java
U hybris/extensions/TRUWebCommon/src/uk/hybris/projects/tru/web/common/beans/UtilsBean.java
U hybris/extensions/TRUWebCommon/src/uk/hybris/projects/tru/web/common/util/MessageUtils.java
U hybris/extensions/TRUCore/project.properties
U hybris/extensions/TRUCore/hmc/resources/uk/hybris/projects/tru/core/hmc/locales_en.properties
C hybris/extensions/TRUCore/hmc/resources/hmc.xml
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/GCPointThreshold.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/GCPointsAllocationConfig.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/OrderModifiedGCPointsRecord.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/GCPointsPerPound.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/GCPointsRecord.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/TruGoldCardAccount.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/GCPointsCalcRecord.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/RefundGCPointsRecord.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/goldcard/GCAccountAuditRecord.java
U hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/returns/ReturnsAuthorisationRecord.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/manager/GoldCardService.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/manager/impl/GoldCardServiceFactoryImpl.java
U hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/manager/impl/OrderServiceImpl.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/manager/impl/GoldCardServiceImpl.java
A hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/manager/GoldCardServiceFactory.java
U hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/order/util/OrderUtils.java
U hybris/extensions/TRUCore/src/uk/hybris/projects/tru/jalo/user/TruCustomer.java
U hybris/extensions/TRUCore/src/uk/hybris/projects/tru/core/event/EventComponent.java
C hybris/extensions/TRUCore/src/uk/hybris/projects/tru/core/jalo/TRUCoreManager.java
C hybris/extensions/TRUCore/src/uk/hybris/projects/tru/core/email/util/EmailHelper.java
C hybris/extensions/TRUCore/src/uk/hybris/projects/tru/core/email/util/OrderVelocityParams.java
U hybris/extensions/TRUCore/src/uk/hybris/projects/tru/core/constants/TRUCoreConstants.java
U hybris/extensions/TRUCore/src/uk/hybris/projects/tru/core/util/StringUtil.java
A hybris/extensions/TRUCore/testsrc/uk/hybris/projects/tru/jalo/manager/GoldCardServiceTest.java
U hybris/extensions/TRUCore/testsrc/uk/hybris/projects/tru/core/jalo/TestUtils.java
U hybris/extensions/TRUCore/resources/TRUCore-items.xml
U hybris/extensions/TRUCore/resources/localization/TRUCore-locales_en.properties
U hybris/extensions/TRUCore/resources/testCase.txt
A hybris/extensions/TRUCore/resources/import/goldcard10
A hybris/extensions/TRUCore/resources/import/goldcard10/trucore_cms.csv
A hybris/extensions/TRUCore/resources/import/goldcard10/trucore_emailtemplates.csv
A hybris/extensions/TRUCore/resources/import/goldcard10/trucore_goldcard.csv
U hybris/extensions/TRUCore/resources/businessinterface.xml
U hybris/extensions/TRUFulfilment/src/uk/hybris/projects/tru/fulfilment/FilterNonFulfillableItemsHandler.java
Skipped missing target: 'hybris/extensions/TRUShopzilla/platformhome.properties'
C hybris/extensions/urlrewrite/urlrewrite.iml
U hybris/extensions/TRUFrontendBusinessLogic/src/uk/hybris/projects/tru/frontend/GoldCardService.java
U hybris/extensions/TRUFrontendBusinessLogic/src/uk/hybris/projects/tru/frontend/impl/OrderModificationServiceImpl.java
U hybris/extensions/TRUFrontendBusinessLogic/src/uk/hybris/projects/tru/frontend/impl/CheckoutServiceImpl.java
U hybris/extensions/TRUFrontendBusinessLogic/src/uk/hybris/projects/tru/frontend/impl/CustomerDetailsServiceImpl.java
U hybris/extensions/TRUFrontendBusinessLogic/src/uk/hybris/projects/tru/frontend/impl/GoldCardServiceImpl.java
U hybris/extensions/TRUFrontendBusinessLogic/src/uk/hybris/projects/tru/frontend/impl/CartServiceImpl.java
U hybris/extensions/TRUFrontendBusinessLogic/src/uk/hybris/projects/tru/frontend/CustomerDetailsService.java
U hybris/extensions/TRUCallCentreUK/web/webroot/pages/orderProcessed.xhtml
U hybris/extensions/TRUCallCentreUK/web/webroot/assets/_ui/css/styles.css
U hybris/extensions/TRUCallCentreUK/web/webroot/tags/cartTag.xhtml
U hybris/extensions/TRUCallCentreUK/web/webroot/tags/deliveryInfoCartTag.xhtml
U hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/TruMotherBabyClubPageContentBean.java
A hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/TruGoldCardAccountBean.java
U hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/TruCustomerRegistrationBean.java
U hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/TruGoldCardPageContentBean.java
A hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/GoldCardRegistrationBean.java
U hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/TruCheckoutBean.java
C hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/TruCustomerDetailsBean.java
A hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/GoldCardAccountDetailsBean.java
U hybris/extensions/TRUWebUK/src/uk/hybris/projects/tru/web/uk/beans/managed/TruLoginBean.java
U hybris/extensions/TRUWebUK/resources/webukconfig-applicationContext.xml
U hybris/extensions/TRUWebUK/web/webroot/pages/register.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/motherBabyClub.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/checkout.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/unregisteredCheckout.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/MyAccount/customerDetails.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/MyAccount/orderModifyAddressConfirm.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/MyAccount/orderModifyDetails.xhtml
A hybris/extensions/TRUWebUK/web/webroot/pages/MyAccount/goldCardAccount.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/MyAccount/orderModifyDateConfirm.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/MyAccount/orderDetails.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/MyAccount/myAccount.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/MyAccount/orderModifyItemsConfirm.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/basket.xhtml
C hybris/extensions/TRUWebUK/web/webroot/pages/goldcard.xhtml
U hybris/extensions/TRUWebUK/web/webroot/pages/orderProcessed.xhtml
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/content_module_wide.gif
U hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/bg_motherbaby_large.jpg
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/buttons/add_child.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/buttons/remove_child.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/buttons/register_now.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/buttons/big_save.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/buttons/register_your_card.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/buttons/continue_button_small.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/buttons/i_would_like_to_apply.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/images/ico_goldcard.gif
C hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/css/layout.css
U hybris/extensions/TRUWebUK/web/webroot/assets/_ui_brus/css/typography.css
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/content_module_wide.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/buttons/add_child.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/buttons/remove_child.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/buttons/register_now.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/buttons/big_save.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/buttons/register_your_card.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/buttons/continue_button_small.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/buttons/i_would_like_to_apply.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_ui/images/ico_goldcard.gif
C hybris/extensions/TRUWebUK/web/webroot/assets/_ui/css/layout.css
C hybris/extensions/TRUWebUK/web/webroot/assets/_ui/css/ie7.css
U hybris/extensions/TRUWebUK/web/webroot/assets/_ui/css/typography.css
U hybris/extensions/TRUWebUK/web/webroot/assets/_ui/js/overlays.js
A hybris/extensions/TRUWebUK/web/webroot/assets/_media/images/birthday_club.jpg
A hybris/extensions/TRUWebUK/web/webroot/assets/_media/images/gamers_club_logo.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_media/images/mother_baby_club_new.gif
A hybris/extensions/TRUWebUK/web/webroot/assets/_media/images/birthday_club.gif
U hybris/extensions/TRUWebUK/web/webroot/WEB-INF/faces-config.xml
U hybris/extensions/TRUWebUK/web/webroot/WEB-INF/config/tru.taglib.xml
U hybris/extensions/TRUWebUK/web/webroot/tags/cartTag.xhtml
U hybris/extensions/TRUWebUK/web/webroot/tags/orderContentsTag.xhtml
U hybris/extensions/TRUWebUK/web/webroot/tags/overlayHelpTag.xhtml
A hybris/extensions/TRUWebUK/web/webroot/tags/birthdayClubTag.xhtml
A hybris/extensions/TRUWebUK/web/webroot/tags/goldCardTag.xhtml
A hybris/extensions/TRUWebUK/web/webroot/tags/gamersClubTag.xhtml
C hybris/extensions/TRUWebUK/web/webroot/tags/registrationDetailsTag.xhtml
A hybris/extensions/TRUWebUK/web/webroot/tags/joinGoldCardTag.xhtml
A hybris/extensions/TRUWebUK/web/webroot/tags/goldCardRegistrationTag.xhtml
A hybris/extensions/TRUWebUK/web/webroot/tags/motherBabiesClubTag.xhtml
U hybris/extensions/TRUWebUK/web/webroot/tags/registrationTag.xhtml
U hybris/extensions/TRUWebUK/web/webroot/tags/inlineHelpTag.xhtml
U hybris/extensions/TRUWebUK/web/webroot/tags/addressSearchEditCheckoutTag.xhtml
U hybris/extensions/TRUWebUK/web/webroot/tags/deliveryInfoCartTag.xhtml
U hybris/extensions/TRUWebUK/web/webroot/tags/addressListTag.xhtml
U hybris/extensions/TRUWebUK/web/webroot/templates/myAccountFrame.xhtml
--- Merging r8154 through r8669 into 'hybris/extensions/TRUWebUK/web/src/uk/hybris/projects/tru/web/TRUWeb_en.properties':
C hybris/extensions/TRUWebUK/web/src/uk/hybris/projects/tru/web/TRUWeb_en.properties
--- Merging r8154 through r8669 into '.':
U hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/file/AnnotatedDelimitedLineSerializer.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/file
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/file/convertor
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/file/convertor/DateTimeAttributeConvertor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/file/convertor/RecordTypeConvertor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/file/convertor/DateAttributeConvertor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/file/convertor/GenderConvertor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/file/convertor/DateTimeNoSecAttributeConvertor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/file/convertor/DateTimeHHmmAttributeConvertor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/PointsBalanceProcessor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/InboundPointsBalanceProcessorImpl.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/TransactionProcessor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/OutboundTransactionProcessorImpl.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/CardDispatchProcessor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/InboundCardDispatchProcessorImpl.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/InboundAccountProcessor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/OutboundAccountProcessor.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/InboundAccountProcessorImpl.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/processor/OutboundAccountProcessorImpl.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/model
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/model/PointsBalance.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/model/Trailer.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/model/Child.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/model/Transaction.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/model/Header.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/model/CardDispatch.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/model/Account.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/service
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/service/InboundPointsBalanceService.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/service/OutboundTransactionService.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/service/InboundCardDispatchService.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/service/BaseInboundService.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/service/BaseOutboundService.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/service/InboundAccountService.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/service/OutboundAccountService.java
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/util
A hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/goldcard/util/GoldCardUtils.java
U hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/jalo/TRUIntegrationManager.java
U hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/warehouse/spark/processor/ConsignmentProcessorImpl.java
U hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/constants/TRUIntegrationConstants.java
U hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/giwebservice/service/GIWebServiceImpl.java
U hybris/extensions/TRUIntegration/src/uk/hybris/projects/tru/integration/giwebservice/service/GIWebService.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/ValidateCardResponse.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/ResponseMessage.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/AddGCApplicationResponse.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/ArrayOfChild.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/AddMBApplicationResponse.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/GetMatchResponse.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/MatchResponse.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/TRUInterfaceSoap.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/ApplicationResponse.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/ValidateCard.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/Child.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/package-info.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/AddGCApplication.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/MatchData.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/ArrayOfResponseMessage.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/GetMatchResponseResponse.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/ArrayOfString.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/TRUInterface.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/AddMBApplication.java
A hybris/extensions/TRUIntegration/src/com/gi_solutionsgroup/truws/ObjectFactory.java
U hybris/extensions/TRUIntegration/resources/config/configservice/default/uk.hybris.projects.tru.integration.service.TransportFactoryService.config.xml
U hybris/extensions/TRUIntegration/resources/config/configservice/default/uk.hybris.projects.tru.integration.service.MessageProcessorService.base.properties
U hybris/extensions/TRUIntegration/resources/config/configservice/prod/uk.hybris.projects.tru.integration.service.MessageProcessorService.config.properties
U hybris/extensions/TRUIntegration/resources/config/configservice/prod/uk.hybris.projects.tru.integration.service.TransportFactoryService.config.xml
A hybris/extensions/TRUIntegration/resources/config/configservice/neow
A hybris/extensions/TRUIntegration/resources/config/configservice/neow/uk.hybris.projects.tru.integration.service.MessageProcessorService.config.properties
U hybris/extensions/TRUIntegration/resources/config/configservice/uat/uk.hybris.projects.tru.integration.service.MessageProcessorService.config.properties
U hybris/extensions/TRUIntegration/resources/config/configservice/uat/uk.hybris.projects.tru.integration.service.TransportFactoryService.config.xml
U hybris/extensions/TRUIntegration/resources/config/configservice/dev/uk.hybris.projects.tru.integration.service.MessageProcessorService.config.properties
A hybris/extensions/TRUIntegration/resources/import/tru_goldcard_integration_jobs.csv
A hybris/extensions/TRUIntegration/resources/import/tru_goldcard_integration_cronjob_triggers.csv
U hybris/extensions/TRUIntegration/resources/integrationconfig-applicationContext.xml
Summary of conflicts:
Text conflicts: 13
Skipped paths: 1

Wednesday, January 12, 2011

Mapping Employee to Manager in Hibernate doing a self join

I have a table containing primary key and foreign key that references same table. How can I implement this mapping in hibernate... structure of tables is as follows..

Dept (

deptno pk
,
dname
,
location
)

employee
(
empid pk
,
ename
,
Manager Id Foregin key references Employee(empid),
deptno
Foregin key references dept(deptno),
doj date
,
)
if the relation is bidirectional, you could have something like this:
          

@Entity

public class Employee implements Serializable {

private Long empid;

private String ename;

private Employee manager;

private Set<Employee> employees = new HashSet<Employee>();

private Dept deptno;

private Date doj;


@Id

@GeneratedValue

public Long getEmpid() {

return empid;

}


public void setEmpid(Long empid) {

this.empid = empid;

}


@ManyToOne

public Employee getManager() {

return manager;

}


public void setManager(Employee manager) {

this.manager = manager;

}


@OneToMany(mappedBy = "manager")

public Set<Employee> getEmployees() {

return employees;

}


public void setEmployees(Set<Employee> employees) {

this.employees = employees;

}


@ManyToOne

public Dept getDeptno() {

return deptno;

}


public void setDeptno(Dept deptno) {

this.deptno = deptno;

}


// ...

}

Nothing fancy for Dept:

@Entity

public class Dept implements Serializable {

private Long deptno;

private String dname;

private String location;


@Id

@GeneratedValue

public Long getDeptno() {

return deptno;

}


public void setDeptno(Long deptno) {

this.deptno = deptno;

}


// ...

}