public static void main(String[] args)
    {
    	
    	// Override CQL version while instantiating entity manager factory.

        EntityManagerFactory emf = Persistence.createEntityManagerFactory("twissandra,twingo,twirdbms");
        EntityManager em = emf.createEntityManager();

        try
        {
        	
        //populate user set from excel sheet.
        Set<User> users = UserBroker.brokeUserList(args[0]);

        for (Iterator<User> iterator = users.iterator(); iterator.hasNext();)
        {
            User user = (User) iterator.next();

            // on Persist
            ExecutorService.onPersist(em, user);
            
                 
            // on find by id.
            ExecutorService.findByKey(em,"BigDataUser");
            
            List<User> fetchedUsers = ExecutorService.onQueryByEmail(em, user);
            
            if (fetchedUsers != null && fetchedUsers.size() > 0)
            {
                logger.info(user.toString());
            }

            logger.info("");
            System.out.println("#######################Querying##########################################");
            logger.info("");
            logger.info("");

        }

        // Execute wild search query.
        String query = "Select u from User u";
        logger.info(query);
        ExecutorService.findByQuery(em, query);

        // // Execute native CQL. Fetch tweets for given user.
        logger.info("");
        System.out.println("#######################Querying##########################################");
        logger.info("");
        logger.info("");

        query = "Select * from tweets where user_id='RDBMSUser'";
        logger.info(query);
        ExecutorService.findByNativeQuery(em,query);
    	} finally
    	{
    		onDestroyDBResources(emf, em);
    	}
    }
public static void main ( String [ ] args ) { EntityManagerFactory emf = Persistence . createEntityManagerFactory ( "twissandra,twingo,twirdbms" ) ; EntityManager em = emf . createEntityManager ( ) ; try { Set < User > users = UserBroker . brokeUserList ( args [ 0 ] ) ; for ( Iterator < User > iterator = users . iterator ( ) ; iterator . hasNext ( ) ; ) { User user = ( User ) iterator . next ( ) ; ExecutorService . onPersist ( em , user ) ; ExecutorService . findByKey ( em , "BigDataUser" ) ; List < User > fetchedUsers = ExecutorService . onQueryByEmail ( em , user ) ; if ( fetchedUsers != null && fetchedUsers . size ( ) > 0 ) { logger . info ( user . toString ( ) ) ; } logger . info ( "" ) ; System . out . println ( "#######################Querying##########################################" ) ; logger . info ( "" ) ; logger . info ( "" ) ; } String query = "Select u from User u" ; logger . info ( query ) ; ExecutorService . findByQuery ( em , query ) ; logger . info ( "" ) ; System . out . println ( "#######################Querying##########################################" ) ; logger . info ( "" ) ; logger . info ( "" ) ; query = "Select * from tweets where user_id='RDBMSUser'" ; logger . info ( query ) ; ExecutorService . findByNativeQuery ( em , query ) ; } finally { onDestroyDBResources ( emf , em ) ; } }
main runner method
@param args takes excel data file as input argument args[0].