Bonjour,

je suis comme qui dirais un peu énervé...

Hier, j'ai développé un jolie code (?!) qui semblait fonctionné (test unitaire ok) et aujourd'hui, plus rien ne marche.

j'ai maintenant une NullPointerException lors de l'appel de ce même code...

Merci d'avance pour vos réponses.

Si joint mon dao, entité et metamodels

dao:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
public class DoogooderDaoImp extends
		AbstractDaoEntityManager<DooGooderEntity, Long> implements DoogooderDao {
 
	/**
         * @param em
         */
	public DoogooderDaoImp(EntityManager em) {
		super(em, DooGooderEntity.class);
		this.em = em;
	}
 
	@Override
	public void delete(DooGooderEntity entity) {
		// em.remove(entity);
		entity.getDoogooderStatus().setId(new Long(4));
		em.persist(entity);
	}
 
	@Override
	public DooGooderEntity findByNamePassword(String login, String pwd)
			throws NoResultException, NonUniqueResultException {
		CriteriaBuilder cb = em.getCriteriaBuilder();
		CriteriaQuery<DooGooderEntity> query = cb
				.createQuery(DooGooderEntity.class);
		Root<DooGooderEntity> rootDg = query.from(DooGooderEntity.class);
		Predicate loginPredicate, pwdPredicate;
		SingularAttribute<DooGooderEntity, String> attLogin = DoogooderEntityMetaModel.login;
		loginPredicate = cb.equal(rootDg.get(attLogin), login);
		pwdPredicate = cb.equal(rootDg.get(DoogooderEntityMetaModel.password), pwd);
		query.where(loginPredicate, pwdPredicate);
		return em.createQuery(query).getSingleResult();
	}
}
meta model:
PS: depuis ce matin, si mon metamodel se nomme DoogooderEntity_, je plante lors du démarrage avec une belle NoClassDefFoundError
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
@StaticMetamodel(DooGooderEntity.class)
public abstract class DoogooderEntityMetaModel {
 
	public static volatile SingularAttribute<DooGooderEntity, Long> id;
	public static volatile SingularAttribute<DooGooderEntity, String> firstname;
	public static volatile SingularAttribute<DooGooderEntity, String> name;
	public static volatile SingularAttribute<DooGooderEntity, String> email;
	public static volatile SingularAttribute<DooGooderEntity, String> login;
	public static volatile SingularAttribute<DooGooderEntity, String> password;
	public static volatile SingularAttribute<DooGooderEntity, String> memberId;
	public static volatile SingularAttribute<DooGooderEntity, Date> birthdate;
	public static volatile SingularAttribute<DooGooderEntity, String> phone;
	public static volatile SingularAttribute<DooGooderEntity, String> mobile;
	public static volatile SingularAttribute<DooGooderEntity, String> gender;
	public static volatile SingularAttribute<DooGooderEntity, Date> premiumTill;
	public static volatile SingularAttribute<DooGooderEntity, UserRoleEntity> userRole;
	public static volatile SingularAttribute<DooGooderEntity, DooGooderStatus> doogooderStatus;
	public static volatile SingularAttribute<DooGooderEntity, String> userName;
	public static volatile SingularAttribute<DooGooderEntity, String> language;
	public static volatile CollectionAttribute<DooGooderEntity, Collection<DoogooderAddressEntity>> addressList;
	public static volatile CollectionAttribute<DooGooderEntity, Collection<Point>> points;
 
}
entité:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
@Entity
@Table(name = DooGooderEntity.TABLE_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = {
		"id", "memberId" }) })
public class DooGooderEntity {
 
	public static final String TABLE_NAME = "tbl_doogooder";
 
	public static final String FIELD_DOOGOODER_ID = "id";
 
	@Id
	@GeneratedValue
	@Column
	private long id;
 
	@Column(length = 50)
	private String firstname;
 
	@Column(length = 50)
	@NotEmpty
	private String name;
 
	@Column(length = 100)
	// @NotEmpty
	private String email;
 
	@Column(length = 20)
	// @NotEmpty
	private String login;
 
	@Column(length = 20)
	// @NotEmpty
	private String password;
 
	@Column(length = 20)
	// @NotEmpty
	private String memberId;
 
	// @NotEmpty
	private java.sql.Date birthdate; // only store date
 
	@Column(length = 15)
	// @NotEmpty
	private String phone;
 
	@Column(length = 15)
	private String mobile;
 
	@Column(length = 5)
	private String gender;
 
	@Column
	private java.sql.Date premiumTill;
 
	@JoinColumn(name = "userRoleid")
	@OneToOne
	private UserRoleEntity userRole;
 
	@JoinColumn(name = "doogooderStatusid")
	@OneToOne
	private DooGooderStatus doogooderStatus;
 
	@Column(length = 50)
	private String userName;
 
	@Column(length = 5)
	private String language;
 
	@OneToMany(mappedBy = DoogooderAddressEntity.DOOGOODER_FIELD_NAME, cascade = CascadeType.ALL)
	private Collection<DoogooderAddressEntity> addressList;
 
	@OneToMany(mappedBy = Point.DOOGOODER_FIELD_NAME, cascade = CascadeType.ALL)
	private Collection<Point> points;