-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: spring aop intercept the hibernate pojo entity methods
PostPosted: Tue Jul 22, 2014 10:21 am 
Newbie

Joined: Mon Jul 21, 2014 10:50 pm
Posts: 1
hi guys
i want to use the spring aop set the pointcut on the method of the hibernate pojo entity.
but it unsuccess.
(my two class name are user and userAction)
my idea is that in the method showuser() of the userAction
it execute user.getName()
the spring aop intercept the getName().
my pointcut define like this:
@Pointcut("execution(* com.hibernate.table..*.get*(..))")
private void checkHibernateEntityMethod() {
}

who can help me ?
how to do?
thanks for your answers.


package com.hibernate.table.entity;
@Entity
@Table(name = "USER")
public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "name", length = 255, unique = true, nullable = false)
private String name;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
)

public class UserAction extends AbstractAction {
@Resource
private UserService userservice;
private Integer id;
public Integer getId(){
return this.id;
}
public void setId(Integer id){
this.id=id;
}
public void showuser() throws JSONException {
User user = userservice.queryuserbyId(getId());
if(null!=user)
user.getName();

}
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.