Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
raja m
i am unable to access the method in usersLocalServiceUtil which return th
20 dicembre 2010 22.20
Risposta

raja m

Punteggio: Junior Member

Messaggi: 26

Data di Iscrizione: 20 dicembre 2010

Messaggi recenti

i am unable to access the method in usersLocalServiceUtil which return the model object
that is the entity object defined in service.xml.

if i access the method that returns integer value it is working correctly but if i access
the method that returns list(consist of entity object) it is not working(from localserviceutil class)

please if anyone can help me.i am unable to get it
raja m
RE: i am unable to access the method in usersLocalServiceUtil which return
20 dicembre 2010 23.18
Risposta

raja m

Punteggio: Junior Member

Messaggi: 26

Data di Iscrizione: 20 dicembre 2010

Messaggi recenti

it is returning size of list as 0 when access the method that return list(which consist of entity object)

but returns the correct size when retutning is integer value
Alexandre FILLATRE
RE: i am unable to access the method in usersLocalServiceUtil which return
21 dicembre 2010 0.03
Risposta

Alexandre FILLATRE

Punteggio: Junior Member

Messaggi: 65

Data di Iscrizione: 2 dicembre 2010

Messaggi recenti

Hi raja,

Can you show us some code plz ?
From where do you call that method ?

Regards,
Alexandre FILLATRE
raja m
RE: i am unable to access the method in usersLocalServiceUtil which return
21 dicembre 2010 0.32
Risposta

raja m

Punteggio: Junior Member

Messaggi: 26

Data di Iscrizione: 20 dicembre 2010

Messaggi recenti

public class ViewLoginuserAction extends PortletAction {


public ActionForward render(
ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
RenderRequest renderRequest, RenderResponse renderResponse)
throws Exception {

if (renderRequest.getWindowState().equals(WindowState.NORMAL)) {
return mapping.findForward("portlet.ext.loginuser.view");
}
else {
int i=0;

int j=0;
int k=0;
java.util.List<users> data=null;

data= usersLocalServiceUtil.findAll();
i=usersLocalServiceUtil.countAll();










System.out.println("sizeofdata"+data.size());
String data1=Integer.toString(i);

List reports = new ArrayList();

reports.add("One");
reports.add("Two");
reports.add("Three");
reports.add(data1);

renderRequest.setAttribute("reports", reports);

return mapping.findForward("portlet.ext.loginuser.view_loginuser");
}
}



i am calling here

usersLocalServiceUtil.findAll();

here it is returning as zero

but in usersLocalServiceUtil.countAll();

it is returning the correct value

my service.xml file is**********************
<?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 5.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_5_2_0.dtd">

<service-builder package-path="com.ext.portlet.loginuser">
<namespace>loginuser</namespace>
<entity name="users" table="users" uuid="true" local-service="true" remote-service="true" persistence-class="com.ext.portlet.loginuser.service.persistence.usersPersistenceImpl">

<!-- PK fields -->

<column name="username" type="String" primary="true" />

<!-- Audit fields -->

<column name="password" type="String" />
<column name="role" type="String" />




<finder name="Password" return-type="Collection">
<finder-column name="password" />
</finder>
<finder name="Role" return-type="Collection">
<finder-column name="role" />
</finder>

<reference package-path="com.liferay.portal" entity="Resource" />

</entity>
<exceptions>
<exception>EntryName</exception>
</exceptions>
</service-builder>

plz help alexandre fillatre
thanks
raja m
RE: i am unable to access the method in usersLocalServiceUtil which return
21 dicembre 2010 2.33
Risposta

raja m

Punteggio: Junior Member

Messaggi: 26

Data di Iscrizione: 20 dicembre 2010

Messaggi recenti

MY PORTAL-EXT.PROPERTIES IS**********


jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal
jdbc.default.username=root
jdbc.default.password=root
Alexandre FILLATRE
RE: i am unable to access the method in usersLocalServiceUtil which return
21 dicembre 2010 3.04
Risposta

Alexandre FILLATRE

Punteggio: Junior Member

Messaggi: 65

Data di Iscrizione: 2 dicembre 2010

Messaggi recenti

I don't see errors in your code (but please use code tags to display it in the forums).
Try to rebuild your entity and service with default values (no uuid="true", no class-persitence, etc.)

You should try to use debug mechanism to see whet's going on in your code. Eclipse has support for this.

Regards,
Alexandre FILLATRE
raja m
RE: i am unable to access the method in usersLocalServiceUtil which return
21 dicembre 2010 5.37
Risposta

raja m

Punteggio: Junior Member

Messaggi: 26

Data di Iscrizione: 20 dicembre 2010

Messaggi recenti

ui tried it.it was not working.

i debugged through by accesing userspersistenceimpl

it is showing null pointer exception in the following code

1 session =openSession();


it is of type
com.liferay.portal.service.persistence.impl.BasePersistenceImpl.openSession

can u identify what is the problem