Obrigado pela dica jvds@bol.com.br , mas o proprietário ainda é removido sem emitir o alerta de que existem imóveis cadastrados.
23:59:45,177 DEBUG [DefaultResourceTranslator] trying to access /proprietario/remove
23:59:45,177 DEBUG [DefaultResourceTranslator] found resource [DefaultResourceMethod: ProprietarioController.removeProprietarioController.remove(Long)]
23:59:45,192 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor FlashInterceptor
23:59:45,200 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor InterceptorListPriorToExecutionExtractor
23:59:45,204 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor JPATransactionInterceptor
23:59:45,221 DEBUG [LazyInterceptorHandler] Invoking interceptor ParametersInstantiatorInterceptor
23:59:45,221 DEBUG [OgnlParametersProvider] Applying idProprietario with [18]
23:59:45,222 DEBUG [ParanamerNameProvider] Found parameter names with paranamer for ImovelController.loadImoveis(Long) as [idProprietario]
23:59:45,222 DEBUG [ParametersInstantiatorInterceptor] Parameter values for [DefaultResourceMethod: ImovelController.loadImoveisImovelController.loadImoveis(Long)] are [18]
23:59:45,225 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor NoCacheInterceptor
23:59:45,227 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor InstantiateInterceptor
23:59:45,228 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor ExceptionHandlerInterceptor
23:59:45,238 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor ExecuteMethodInterceptor
23:59:45,238 DEBUG [ExecuteMethodInterceptor] Invoking ImovelController.loadImoveis(Long)
Hibernate:
select
count(this_.cod_imovel) as y0_
from
Imovel this_
inner join
Proprietario p1_
on this_.proprietario_id_proprietario=p1_.id_proprietario
where
p1_.id_proprietario=?
23:59:45,256 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor ForwardToDefaultViewInterceptor
23:59:45,256 DEBUG [ForwardToDefaultViewInterceptor] forwarding to the dafault page for this logic
23:59:45,267 DEBUG [LazyInterceptorHandler] Invoking interceptor ParametersInstantiatorInterceptor
23:59:45,267 DEBUG [AsmBasedTypeCreator ] Trying to make class for ProprietarioController$remove$944595671$7
23:59:45,268 DEBUG [ParanamerNameProvider] Found parameter names with paranamer for ProprietarioController.remove(Long) as [idProprietario]
23:59:45,268 DEBUG [AsmBasedTypeCreator ] Parameter names found for creating type are: [IdProprietario]
23:59:45,268 DEBUG [AsmBasedTypeCreator ] Method for field 'IdProprietario' being defined for type Ljava/lang/Long;
23:59:45,269 DEBUG [AsmBasedTypeCreator ] Methods: [public java.lang.Long ProprietarioController$remove$944595671$7.getIdProprietario(), public void ProprietarioController$remove$944595671$7.setIdProprietario(java.lang.Long)]
23:59:45,269 DEBUG [AsmBasedTypeCreator ] Fields: [private java.lang.Long ProprietarioController$remove$944595671$7.IdProprietario_]
23:59:45,269 DEBUG [CacheBasedTypeCreator] cached generic type for method [DefaultResourceMethod: ProprietarioController.removeProprietarioController.remove(Long)]
23:59:45,269 DEBUG [OgnlParametersProvider] Applying idProprietario with [18]
23:59:45,271 DEBUG [ParanamerNameProvider] Found parameter names with paranamer for ProprietarioController.remove(Long) as [idProprietario]
23:59:45,271 DEBUG [ParametersInstantiatorInterceptor] Parameter values for [DefaultResourceMethod: ProprietarioController.removeProprietarioController.remove(Long)] are [18]
23:59:45,277 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor ExceptionHandlerInterceptor
23:59:45,279 DEBUG [DefaultPageResult ] forwarding to /WEB-INF/jsp/imovel/loadImoveis.jsp
23:59:45,280 DEBUG [VRaptor ] VRaptor received a new request
23:59:45,281 DEBUG [ToInstantiateInterceptorHandler] Invoking interceptor ExecuteMethodInterceptor
23:59:45,282 DEBUG [ExecuteMethodInterceptor] Invoking ProprietarioController.remove(Long)
Estou passando a id pra função por parâmetro desta forma:
function alertaComImoveis(idProprietario) {
var id = idProprietario;
$.post('/imobiliaria/imovel/loadImoveis',
{'idProprietario': id},
function(data) {
var qtde = data.imoveis;
alert('Este proprietário possui' + qtde + 'imóveis, deseja excluir o proprietário e todos seus imóveis?' );
});
}
Aparentemente só falta a função capturar os dados vindos do result e mostrar no alerta, essa parte que eu não sei como funciona com o VRaptor…
Abraço!