Hello,
Help me, i need to make a relantionship with 1:N
Phone.java has a FK (cli_id)
Code:
Client.java
[...]
@OneToMany
@JoinColumn(name="cli_id")
private List<Phone> phone;
[...]
Code:
Phone.java
[...]
@ManyToOne
@JoinColumn(name="cli_id")
private Client client;
[...]
Code:
[...]
Use.java
Cliente cli = new Cliente();
Phone tel = new Phone();
List<Phone> lis = null;
cli.setCli_name("help");
tel.setPho_num(12);
lis.add(tel);
cli.setCli_phone(lis);
dao.saveRecord(cli);
[...]
Code:
[...]
Error
DEBUG - AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(253) | Invoking BeanPostProcessors before instantiation of bean 'clientDAO'
DEBUG - CachedIntrospectionResults.<init>(148) | Getting BeanInfo for class [org.model.dao.ClientDAOImpl]
Exception in thread "main" java.lang.NullPointerException
at teste.TesteCliente.main(Use.java:45)
DEBUG - CachedIntrospectionResults.<init>(164) | Caching PropertyDescriptors for class [org.model.dao.ClientDAOImpl]
[...]
; (
I trying to save a list of phones directly on client (set)
best regards, John