You might want to try replace @Element(column = "role_id") with @Column(name="role_id")
On Sun, Oct 19, 2014 at 8:56 PM, Erik de Hair <[email protected]> wrote: > Some extra information I found out: > > The exception only occurs when the Contact has NO role assigned. > > Erik > > ________________________________________ > From: Dan Haywood [[email protected]] > Sent: Friday, October 17, 2014 5:48 PM > To: users > Subject: Re: error while updating entity using entity page > > I'd be happy to do a TeamViewer session with you remotely one evening or > weekend to track down. Contact me offline to arrange. > > In the meantime, when the exception occurs, can you tell (from the > OneToOneAssociation) which property it is that's being processed? > > Cheers > Dan > > > On 17 October 2014 16:23, Erik de Hair <[email protected]> wrote: > > > Tried to isolate the entity in the todoapp with its only 2 relations but > > that way I can't reproduce the problem... > > > > > > On 10/17/2014 04:34 PM, Erik de Hair wrote: > > > >> Hi Dan, > >> > >> The Isis version is 1.6.0 > >> > >> I can't provide a simple demo app without almost putting all our domain > >> code and services on github. There are to much dependencies for that. > The > >> entity it's all about. Hope you can find something. > >> > >> @javax.jdo.annotations.PersistenceCapable(table = "contactpersonen", > >> identityType = IdentityType.APPLICATION) > >> @Bookmarkable > >> public class Contact extends PortalAbstractDomainObject implements > >> SecuredPerInstance, Comparable<Contact> > >> { > >> private final static Logger LOG = LoggerFactory.getLogger( > >> Contact.class); > >> > >> private int id; > >> @Hidden > >> @PrimaryKey > >> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > >> public int getId() > >> { > >> return id; > >> } > >> > >> public void setId(int id) > >> { > >> this.id = id; > >> } > >> > >> // ignored fields > >> // id int(11) PK AI -> see identity above > >> > >> private int internalCompany = 1; > >> > >> @Hidden > >> @Column(name = "bedrijf_id", allowsNull = "true") > >> public int getInternalCompany() > >> { > >> return internalCompany; > >> } > >> > >> public void setInternalCompany(int internalCompany) > >> { > >> this.internalCompany = 1; > >> } > >> > >> private String enumGender; > >> > >> @Named("Geslacht") > >> @Column(name = "geslacht", allowsNull = "false", length = 9) > >> @Disabled > >> public String getEnumGender() > >> { > >> return enumGender; > >> } > >> > >> public void setEnumGender(String enumGender) > >> { > >> this.enumGender = enumGender; > >> } > >> > >> private String firstName; > >> > >> @MaxLength(value = 50) > >> @Named("Voornaam") > >> @Column(name = "voornaam", allowsNull = "true") > >> public String getFirstName() > >> { > >> return firstName; > >> } > >> > >> public void setFirstName(String firstName) > >> { > >> this.firstName = firstName; > >> } > >> > >> /** > >> * Update complete name when updating first name > >> * > >> * @param firstName > >> */ > >> public void modifyFirstName(String firstName) > >> { > >> setFirstName(firstName); > >> resetName(); > >> } > >> > >> private String namePrefix; > >> > >> @MaxLength(value = 15) > >> @Named("Tussenvoegsel(s)") > >> @Column(name = "tussenvoegsels", allowsNull = "true") > >> public String getNamePrefix() > >> { > >> return namePrefix; > >> } > >> > >> public void setNamePrefix(String namePrefix) > >> { > >> this.namePrefix = namePrefix; > >> } > >> > >> /** > >> * Update complete name when updating name prefix > >> * > >> * @param namePrefix > >> */ > >> public void modifyNamePrefix(String namePrefix) > >> { > >> setNamePrefix(namePrefix); > >> resetName(); > >> } > >> > >> private String lastName; > >> > >> @MaxLength(value = 50) > >> @Named("Achternaam") > >> @Column(name = "achternaam", allowsNull = "true") > >> public String getLastName() > >> { > >> return lastName; > >> } > >> > >> public void setLastName(String lastName) > >> { > >> this.lastName = lastName; > >> } > >> > >> /** > >> * Update complete name when updating last name > >> * > >> * @param lastName > >> */ > >> public void modifyLastName(String lastName) > >> { > >> setLastName(lastName); > >> resetName(); > >> } > >> > >> private String name; > >> @Title > >> @MaxLength(value = 100) > >> @Named("Naam") > >> @Column(name = "naam", allowsNull = "true") > >> public String getName() > >> { > >> return this.name; > >> } > >> > >> public void setName(String name) > >> { > >> this.name = name; > >> } > >> > >> private void resetName() > >> { > >> StringBuffer name = new StringBuffer(); > >> if (this.getFirstName() != null && > !this.getFirstName().isEmpty() > >> ) > >> { > >> name.append(this.getFirstName()); > >> } > >> if (this.getNamePrefix() != null && > !this.getNamePrefix().isEmpty( > >> )) > >> { > >> if (name.length() > 0) > >> { > >> name.append(" "); > >> } > >> name.append(this.getNamePrefix()); > >> } > >> if (this.getLastName() != null && !this.getLastName().isEmpty()) > >> { > >> if (name.length() > 0) > >> { > >> name.append(" "); > >> } > >> name.append(getLastName()); > >> } > >> setName(name.toString()); > >> } > >> > >> private String street; > >> @Column(name = "straat", allowsNull = "true") > >> @MaxLength(value = 255) > >> public String getStreet() > >> { > >> return street; > >> } > >> > >> public void setStreet(String address) > >> { > >> this.street = address; > >> } > >> > >> private String houseNumber; > >> > >> @Column(name = "huisnummer", allowsNull = "true") > >> public String getHouseNumber() > >> { > >> return houseNumber; > >> } > >> public void setHouseNumber(String houseNumber) > >> { > >> this.houseNumber = houseNumber; > >> } > >> > >> private String houseNumberExtension; > >> > >> @Column(name = "huisnummertoevoeging", allowsNull = "true") > >> public String getHouseNumberExtension() > >> { > >> return houseNumberExtension; > >> } > >> public void setHouseNumberExtension(String houseNumberExtension) > >> { > >> this.houseNumberExtension = houseNumberExtension; > >> } > >> > >> > >> private String postalCode; > >> > >> @MaxLength(value = 7) > >> @Named("Postcode") > >> @Column(name = "postcode", allowsNull = "true") > >> public String getPostalCode() > >> { > >> return postalCode; > >> } > >> > >> public void setPostalCode(String postalCode) > >> { > >> this.postalCode = postalCode; > >> } > >> > >> private String residence; > >> > >> @MaxLength(value = 50) > >> @Named("Plaats") > >> @Column(name = "plaats", allowsNull = "true") > >> public String getResidence() > >> { > >> return residence; > >> } > >> > >> public void setResidence(String residence) > >> { > >> this.residence = residence; > >> } > >> > >> private String country; > >> > >> @MaxLength(value = 50) > >> @Named("Land") > >> @Column(name = "land", allowsNull = "true") > >> public String getCountry() > >> { > >> return country; > >> } > >> > >> public void setCountry(String country) > >> { > >> this.country = country; > >> } > >> > >> private String locale; > >> > >> @MaxLength(value = 10) > >> @Named("Locale") > >> @Column(name = "locale", allowsNull = "true") > >> public String getLocale() > >> { > >> return locale; > >> } > >> > >> public void setLocale(String locale) > >> { > >> this.locale = locale; > >> } > >> > >> private LocalDate birthday; > >> > >> @Named("Geboortedatum") > >> @Column(name = "geb_datum", allowsNull = "true") > >> public LocalDate getBirthday() > >> { > >> return birthday; > >> } > >> > >> public void setBirthday(LocalDate birthday) > >> { > >> this.birthday = birthday; > >> } > >> > >> private String phone; > >> > >> @MaxLength(value = 20) > >> @Named("Telefoon") > >> @Column(name = "tel_vast", allowsNull = "true") > >> public String getPhone() > >> { > >> return phone; > >> } > >> > >> public void setPhone(String phone) > >> { > >> this.phone = phone; > >> } > >> > >> private String phoneCompany; > >> > >> @MaxLength(value = 20) > >> @Named("Telefoon zakelijk") > >> @Column(name = "tel_zaak", allowsNull = "true") > >> public String getPhoneCompany() > >> { > >> return phoneCompany; > >> } > >> > >> public void setPhoneCompany(String phoneCompany) > >> { > >> this.phoneCompany = phoneCompany; > >> } > >> > >> private String cellPhone; > >> > >> @MaxLength(value = 20) > >> @Named("Mobiele telefoon") > >> @Column(name = "tel_mobiel", allowsNull = "true") > >> public String getCellPhone() > >> { > >> return cellPhone; > >> } > >> > >> public void setCellPhone(String cellPhone) > >> { > >> this.cellPhone = cellPhone; > >> } > >> > >> private String email; > >> > >> @MaxLength(value = 100) > >> @Named("E-mail") > >> @Column(name = "email", allowsNull = "true") > >> @RegEx(validation = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", > >> caseSensitive = false) > >> public String getEmail() > >> { > >> return email; > >> } > >> > >> public void setEmail(String email) > >> { > >> this.email = email; > >> } > >> > >> private String occupation; > >> > >> @MaxLength(value = 100) > >> @Named("Functie") > >> @Column(name = "functie", allowsNull = "true") > >> public String getOccupation() > >> { > >> return occupation; > >> } > >> > >> public void setOccupation(String occupation) > >> { > >> this.occupation = occupation; > >> } > >> > >> /** > >> * The company the contact represents (is the contact for) > >> */ > >> private PortalCompany representedCompany; > >> > >> @Named("Werkzaam voor") > >> @Column(name = "referentie", allowsNull = "true") > >> public PortalCompany getRepresentedCompany() > >> { > >> return representedCompany; > >> } > >> > >> public void setRepresentedCompany(PortalCompany representedCompany) > >> { > >> this.representedCompany = representedCompany; > >> } > >> > >> private String belongsTo = "klant"; > >> > >> @MaxLength(value = 20) > >> @Column(name = "hoort_bij", allowsNull = "true") > >> public String getBelongsTo() > >> { > >> return belongsTo; > >> } > >> > >> public void setBelongsTo(String belongsTo) > >> { > >> this.belongsTo = belongsTo; > >> } > >> > >> private boolean active; > >> > >> @Named("Actief") > >> @Column(name = "actief", allowsNull = "false") > >> public boolean isActive() > >> { > >> return active; > >> } > >> > >> public void setActive(boolean active) > >> { > >> this.active = active; > >> } > >> > >> private String ripehandle; > >> > >> @MaxLength(value = 255) > >> @Named("RIPE handle") > >> @Column > >> public String getRipehandle() > >> { > >> return ripehandle; > >> } > >> > >> public void setRipehandle(String ripehandle) > >> { > >> this.ripehandle = ripehandle; > >> } > >> > >> private String username; > >> > >> @MemberOrder(name = "Gebruikersaccount", sequence = "2") > >> @Unique > >> @MaxLength(value = 45) > >> @Named("Gebruikersnaam") > >> @Column(name = "gebruikersnaam", allowsNull = "true") > >> @Disabled > >> public String getUsername() > >> { > >> return username; > >> } > >> > >> public void setUsername(String username) > >> { > >> this.username = username; > >> } > >> > >> private String password; > >> > >> @Hidden(when = When.ALWAYS) > >> @Disabled > >> @MaxLength(value = 255) > >> @Column(name = "wachtwoord", allowsNull = "true") > >> public String getPassword() > >> { > >> return password; > >> } > >> > >> /** > >> * @param password the password to set > >> */ > >> public void setPassword(String password) > >> { > >> this.password = password; > >> } > >> > >> /** > >> * Encrypt the password > >> * > >> * @param plaintextPassword > >> */ > >> public void modifyPassword(String plaintextPassword) > >> { > >> DefaultPasswordService ps = new DefaultPasswordService(); > >> setPassword(ps.encryptPassword(plaintextPassword)); > >> } > >> > >> /** > >> * The user's application roles > >> */ > >> private SortedSet<Role> roles = new TreeSet<Role>(); > >> > >> @Hidden > >> @Persistent(table = "users_roles") > >> @Join(column = "user_id") > >> @Element(column = "role_id") > >> public SortedSet<Role> getRoles() > >> { > >> return roles; > >> } > >> > >> public void setRoles(SortedSet<Role> roles) > >> { > >> this.roles = roles; > >> } > >> > >> @MemberOrder(name = "Gebruikersaccount", sequence = "3") > >> @Named("Gebruikersrol") > >> @Optional > >> public String getRole() > >> { > >> return (this.getRoles().isEmpty() ? null : > >> this.getRoles().first().getDescription()); > >> } > >> > >> private boolean isUser() > >> { > >> return this.getUsername() != null && > >> !this.getUsername().isEmpty(); > >> } > >> > >> > >> > >> > >> On 10/17/2014 02:37 PM, Dan Haywood wrote: > >> > >>> Can you post the domain code for this? > >>> > >>> And which version of Isis? > >>> > >>> Ideally... can you provide a simple demo app on github? > >>> > >>> Thx > >>> Dan > >>> > >>> > >>> > >>> On 17 October 2014 11:19, Erik de Hair <[email protected]> wrote: > >>> > >>> Hi, > >>>> > >>>> Does any body know why I'm getting the following exception when > saving a > >>>> modified entity by using its entity page > >>>> > >>>> Caused by: java.lang.NullPointerException > >>>> at org.apache.isis.core.metamodel.specloader.specimpl. > >>>> OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199) > >>>> at org.apache.isis.core.metamodel.specloader.specimpl. > >>>> OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163) > >>>> at org.apache.isis.viewer.wicket.model.models.EntityModel. > >>>> apply(EntityModel.java:594) > >>>> at org.apache.isis.viewer.wicket.ui.components.entity.properties. > >>>> > EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505) > >>>> > >>>> at org.apache.isis.viewer.wicket.ui.components.entity.properties. > >>>> EntityPropertiesForm.access$500(EntityPropertiesForm.java:75) > >>>> at org.apache.isis.viewer.wicket.ui.components.entity.properties. > >>>> > EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm. > >>>> > >>>> java:333) > >>>> at org.apache.wicket.ajax.markup.html.form.AjaxButton$1. > >>>> onSubmit(AjaxButton.java:108) > >>>> at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit( > >>>> AjaxFormSubmitBehavior.java:179) > >>>> at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form. > >>>> java:1266) > >>>> at org.apache.wicket.markup.html.form.Form.process(Form.java:938) > >>>> at org.apache.isis.viewer.wicket.ui.panels.FormAbstract. > >>>> process(FormAbstract.java:110) > >>>> at org.apache.wicket.markup.html.form.Form.onFormSubmitted( > >>>> Form.java:770) > >>>> at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent( > >>>> AjaxFormSubmitBehavior.java:156) > >>>> at org.apache.wicket.ajax.AjaxEventBehavior.respond( > >>>> AjaxEventBehavior.java:123) > >>>> at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest( > >>>> AbstractDefaultAjaxBehavior.java:633) > >>>> > >>>> the objectAdapter param for OneToOneAssociationImpl.set( > >>>> OneToOneAssociationImpl.java:163) is the editted entity and the new > >>>> value > >>>> is null. The underlying facet method is a getter method for a String > >>>> property of the entity that indeed is empty. > >>>> > >>>> Thanks, > >>>> Erik > >>>> > >>>> > >> > >> > > >
