Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on editing entity with many-to-many mappedBy property #2811

Closed
andreysubbotin opened this issue Apr 7, 2020 · 1 comment
Closed

Error on editing entity with many-to-many mappedBy property #2811

andreysubbotin opened this issue Apr 7, 2020 · 1 comment
Assignees
Labels
state: fixed Fixed by the developer type: bug Something isn't working ver: 7.2.5 Fixed in version ver: 7.3.0 Fixed in version
Milestone

Comments

@andreysubbotin
Copy link
Contributor

andreysubbotin commented Apr 7, 2020

https://www.cuba-platform.ru/discuss/t/sozdanie-inversnogo-atributa-studiej/4146

Environment

  • Platform version: 7.2

Description of the bug or enhancement

  • Create entity with toMany property:
@ManyToMany(mappedBy = "details")
protected List<NewEntity> newEntities;
  • Try to open entity editor. Error occurs:
java.lang.ClassCastException: com.company.testviews.entity.InterMediate cannot be cast to java.util.List
	at com.haulmont.chile.core.model.utils.MethodsCache$SettersHolder.accept(MethodsCache.java:193)
	at com.haulmont.chile.core.model.impl.AbstractInstance.setValue(AbstractInstance.java:160)
	at com.haulmont.cuba.core.entity.BaseGenericIdEntity.setValue(BaseGenericIdEntity.java:126)
	at com.haulmont.chile.core.model.impl.AbstractInstance.setValue(AbstractInstance.java:142)
	at com.haulmont.cuba.gui.builders.EditorBuilderProcessor.initializeNestedEntity(EditorBuilderProcessor.java:308)
	at com.haulmont.cuba.gui.builders.EditorBuilderProcessor.initEntity(EditorBuilderProcessor.java:224)
	at com.haulmont.cuba.gui.builders.EditorBuilderProcessor.buildEditor(EditorBuilderProcessor.java:80)
	at com.haulmont.cuba.gui.builders.EditorBuilder.show(EditorBuilder.java:366)
	at com.company.testviews.web.screens.order.OrderFragment.createDetailEntity(OrderFragment.java:37)
	at com.company.testviews.web.screens.order.OrderFragment.onOrderDetailsTableCreate(OrderFragment.java:26)
	at com.haulmont.bali.events.EventHub.publish(EventHub.java:170)
	at com.haulmont.cuba.gui.components.actions.BaseAction.actionPerform(BaseAction.java:222)
	at com.haulmont.cuba.gui.actions.list.CreateAction.actionPerform(CreateAction.java:288)
	at com.haulmont.cuba.web.gui.components.WebButton.buttonClicked(WebButton.java:67)
	at com.haulmont.cuba.web.widgets.CubaButton.fireClick(CubaButton.java:76)
	at com.vaadin.ui.Button$1.click(Button.java:57)
@knstvk knstvk added the type: bug Something isn't working label May 12, 2020
@knstvk knstvk added this to the Release 7.2 milestone May 12, 2020
@knstvk knstvk assigned knstvk and unassigned t2-cuba May 12, 2020
@knstvk knstvk changed the title Support many to many associations by mappedBy property Error on editing entity with many-to-many mappedBy property Jun 4, 2020
@haulmont-git haulmont-git added the ver: 7.2.5 Fixed in version label Jun 4, 2020
@haulmont-git haulmont-git added the ver: 7.3.0 Fixed in version label Jun 4, 2020
@knstvk
Copy link
Member

knstvk commented Jun 4, 2020

QA: how to reproduce - start the attached project, edit Product, click "New tag".
m2m-mappedby.zip

@natfirst natfirst self-assigned this Jun 4, 2020
@natfirst natfirst added the state: fixed Fixed by the developer label Jun 4, 2020
@natfirst natfirst closed this as completed Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: fixed Fixed by the developer type: bug Something isn't working ver: 7.2.5 Fixed in version ver: 7.3.0 Fixed in version
Projects
None yet
Development

No branches or pull requests

5 participants