Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
BasicCrudView example updatet to Vaadin 7 doesn't work
Hello,
I have used the BasicCrudView example in my project, since I have updated this I get the following exception when I push the Button add.
I have updated my project from Vaadin 6.7.4 to 7.4.3 and get now the following exception:
Aug 18, 2015 11:09:33 AM com.vaadin.server.DefaultErrorHandler doDefaultSCHWERWIEGEND:javax.validation.ConstraintViolationException: Bean Validation constraint(s) violated while executing Automatic Bean Validation on callback event:'prePersist'. Please refer to embedded ConstraintViolations for details. at org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener.validateOnCallbackEvent(BeanValidationListener.java:108) at org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener.prePersist(BeanValidationListener.java:77) at org.eclipse.persistence.descriptors.DescriptorEventManager.notifyListener(DescriptorEventManager.java:748) at org.eclipse.persistence.descriptors.DescriptorEventManager.notifyEJB30Listeners(DescriptorEventManager.java:691) at org.eclipse.persistence.descriptors.DescriptorEventManager.executeEvent(DescriptorEventManager.java:229) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectClone(UnitOfWorkImpl.java:4314)
Does anyone have an example or an idea what I must change to solve this problem?
Hard to say based on the information you've provided. It's a constrain violation that happens in your bean, but you haven't provided the bean that is being validated. If it has worked with Vaadin 6, but doesn't work with Vaadin 7, then it is possible that something has changed in the JPAContainer, but a simplified test case with an example bean would be benefital in order to pinpoint the actual cause.
A quick google search on the problem suggests that there might be something wrong with the order of your validations. See this thread about further investigating what is actually going wrong, and this thread about an example case of how to solve the issue (see the accepted answer, the one with the green tick).
Now I know when the error comes...every entitiy which has the Notation @NotNull doesn't work.
Does anybody has an idea how can I solve this problem?
You probably don't have a bean validation implementation on you classpath. The easiest way is to use some Java EE server (instead of a plain servlet container) as they provide that for you. Alternativily you can add one manually to your project. Try for example Hibernate Validator.
cheers,
matti
Sorry, but I have no idea to solve the problem.
Now I have add the complete project as attachment (without the libs), hope somebody could help me.
I have no idea to add the hibernate validator or what i must do for this "implementation on you classpath"
Now it works, but I have another problem:
I must change my entity declarion to have the option for "JPAContainer.addNestedContainerProperty.."
Here the Code of the Entity
@Entity
public class Firma
{
@Id
@GeneratedValue
private long id;
@NotNull
private String firma;
@OneToMany(mappedBy = "firmaID", targetEntity = Werk.class, cascade = CascadeType.ALL)
private Set<Werk> werks;
Now in the BasicCriud Window it comes a table with Set werks see attachment, could I anything do that it is not visilble?
Like this, but visible false so that i must no write every attribut from the entity:
Set<EntityType<?>> entities = metamodel.getEntities();
for (EntityType<?> entityType : entities) {
Class<?> javaType = entityType.getJavaType();
BasicCrudView view = new BasicCrudView(javaType,
Schulung.PERSISTENCE_UNIT);
navTree.addItem(view);
navTree.setItemCaption(view, view.getCaption());
navTree.setChildrenAllowed(view, false);
if(javaType == Firma.class) { view.setVisibleTableProperties("firma","nameXYZ"); view.setVisibleFormProperties("firma","nameXYZ", "id"); }