I am attaching an Object
Set<State> stateSet = new HashSet<State>();
// STATE ONE
stateOne = new State();
stateOne.setStateName("KARNATAKA");
stateOne.setStateId(new Long(1));
// STATE TWO
stateTwo = new State();
stateTwo.setStateName("UP");
stateTwo.setStateId(new Long(2));
// ADD STATES TO A SET
stateSet.add(stateOne);
stateSet.add(stateTwo);
// ADD A COUNTRY
Country country = new Country();
country.setCountryId(new Long(1));
country.setCountryName("INDIA");
stateOne.setCountry(country); // set the country reference
stateTwo.setCountry(country); // set the country reference
cache.attach("/pojo1", stateOne);
I now want to persist this to Database....Please help me with some code to carry on.
Is it necessary to create a JDBCCacheLoader to load STATE ?