Hi,
I have a menu action like this, listAll action:
@DomainService(
nature = NatureOfService.VIEW_MENU_ONLY,
objectType = "profile-preferences-services",
repositoryFor = ProfilePreferences.class
)
@DomainServiceLayout(
named = "Profile Preferences",
menuOrder = "3"
)
public class ProfilePreferencesMenu {
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
@MemberOrder(sequence = "1")
public List<ProfilePreferences> listAll() {
return profilePreferencesRepository.listAll();
}
.
.
.
My Entity is that:
@javax.jdo.annotations.PersistenceCapable(
identityType=IdentityType.APPLICATION,
table="profile_preferences",
schema = "dbo"
)
@javax.jdo.annotations.Version(
strategy= VersionStrategy.VERSION_NUMBER,
column="version")
@javax.jdo.annotations.Queries({
@javax.jdo.annotations.Query(
name = "get",
value = "SELECT "
+ "FROM
com.foreks.user.settings.domain.preferences.ProfilePreferences "
+ "WHERE profileName.equals(:name)")
})
@DomainObject(
objectType = "profile-preferences"
)
public class ProfilePreferences implements Comparable<ProfilePreferences> {
public ProfilePreferences(final String profileName) {
setProfileName(profileName);
}
@javax.jdo.annotations.Column(allowsNull = "false", length= 150)
@PrimaryKey
@Getter @Setter
@Title(prepend = "Profile Preferences: ")
private String profileName;
@javax.jdo.annotations.Column(allowsNull = "true", length = 4000)
@Property(editing = Editing.ENABLED,hidden = Where.ALL_TABLES)
@Getter @Setter
private String preferences;
//region > delete (action)
@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
public void delete() {
final String title = titleService.titleOf(this);
messageService.informUser(String.format("'%s' deleted", title));
repositoryService.remove(this);
}
//endregion
//region > delete (action)
@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
public ProfilePreferences copy(@ParameterLayout(named="Profile Name")
String name) {
final ProfilePreferences object = new ProfilePreferences(name);
object.setPreferences(preferences);
repositoryService.persist(object);
return object;
}
//endregion
//region > toString, compareTo
@Override
public String toString() {
return ObjectContracts.toString(this, "profileName");
}
@Override
public int compareTo(final ProfilePreferences other) {
return ObjectContracts.compare(this, other, "profileName");
}
//endregion
//region > injected services
@javax.inject.Inject
RepositoryService repositoryService;
@javax.inject.Inject
TitleService titleService;
@javax.inject.Inject
MessageService messageService;
//endregion
}
When I click the List All action from the wicket viewer menu, server logs
this SQL queries:
19:03:07,334 [Native http-nio-8080-exec-4 DEBUG] SELECT
'com.foreks.user.settings.domain.preferences.ProfilePreferences' AS
NUCLEUS_TYPE,A0.preferences,A0.profileName,A0.version FROM
dbo.profile_preferences A0
19:03:07,436 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'ahl'>
19:03:07,442 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'akbank'>
19:03:07,448 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'bmd'>
19:03:07,454 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'DELTA'>
19:03:07,460 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'foreks'>
19:03:07,466 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'halky'>
19:03:07,472 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'hcbs'>
19:03:07,477 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'issanal'>
19:03:07,483 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'marbas'>
19:03:07,489 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'odeabank'>
19:03:07,495 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'odtu'>
19:03:07,500 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'osmanli'>
19:03:07,506 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'piramit'>
19:03:07,512 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'tebsanal'>
19:03:07,517 [Native http-nio-8080-exec-5 DEBUG] SELECT
A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE
A0.profileName = <'ZIRAAT'>
There is a query for each entity. The firs query
SELECT 'com.foreks.user.settings.domain.preferences.ProfilePreferences' AS
NUCLEUS_TYPE,A0.preferences,A0.profileName,A0.version FROM
dbo.profile_preferences A0
should be enough. Query for every entity becomes a performance problem. How
can I prevent this behavior ? Is there some thing wrong or missing in my
Entity Class or Menu Action Class ?
Help please :)
--
<http://www.foreksmobile.com/redirect.html>
P
Bu mesaji yazdirmadan önce çevreye olan sorumlulugumuzu bir kez daha
düsünelim.
Please consider the environment before printing this e-mail.
Bu elektronik posta ve onunla iletilen bütün dosyalar sadece göndericisi
tarafından alması amaçlanan yetkili gerçek ya da tüzel kişinin kullanımı
içindir. Eğer söz konusu yetkili alıcı değilseniz bu elektronik postanın
içeriğini açıklamanız, kopyalamanız, yönlendirmeniz ve kullanmanız
kesinlikle yasaktır ve bu elektronik postayı derhal silmeniz gerekmektedir.
FOREKS bu mesajın içerdiği bilgilerin doğruluğu veya eksiksiz olduğu
konusunda herhangi bir garanti vermemektedir. Bu nedenle bu bilgilerin ne
şekilde olursa olsun içeriğinden, iletilmesinden, alınmasından ve
saklanmasından sorumlu değildir. Bu mesajdaki görüşler yalnızca gönderen
kişiye aittir ve FOREKS'in görüşlerini yansıtmayabilir.
Bu e-posta bilinen bütün bilgisayar virüslerine karşı taranmıştır.
*
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient you are hereby notified that any
dissemination, forwarding, copying or use of any of the information is
strictly prohibited, and the e-mail should immediately be deleted. FOREKS makes
no warranty as to the accuracy or completeness of any information contained
in this message and hereby excludes any liability of any kind for the
information contained therein or for the information transmission,
reception, storage or use of such in any way whatsoever. The opinions
expressed in this message belong to sender alone and may not necessarily
reflect the opinions of FOREKS.
This e-mail has been scanned for all known computer viruses.