Created
February 16, 2015 13:13
-
-
Save adit2787/7fc4c7afa3aa41c69c41 to your computer and use it in GitHub Desktop.
Many To Many doView()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { | |
try { | |
Employee employee; | |
employee = EmployeeLocalServiceUtil.createEmployee(CounterLocalServiceUtil.increment()); | |
employee.setAddress("Delhi"); | |
employee.setName("Ramesh"); | |
employee = EmployeeLocalServiceUtil.addEmployee(employee); | |
Department department1,department2; | |
department1 = DepartmentLocalServiceUtil.createDepartment(CounterLocalServiceUtil.increment()); | |
department1.setDepartment("IT"); | |
department1 =DepartmentLocalServiceUtil.addDepartment(department1); | |
department2 = DepartmentLocalServiceUtil.createDepartment(CounterLocalServiceUtil.increment()); | |
department2.setDepartment("Research"); | |
department2 =DepartmentLocalServiceUtil.addDepartment(department2); | |
DepartmentLocalServiceUtil.addEmployeeDepartments(employee.getEid(), new long[]{department1.getDeptid(),department2.getDeptid()}); | |
} | |
catch (SystemException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment