How to Upload excel and load the excel data to table

Hi,

I want to upload a excel file and want to load this excel data to different tables.
Can you please help here?

Regards,
Mallik

Hi Gleb,

Where the uploaded file will be stored.

Regards,
Mallik

Hi,

Take a look at this sample application.

Regards,
Gleb

Hi,

By default in a local file storage.

Regards,
Gleb

Hi Gleb
How can we read the imported excel file and show that in a table, I may have missed it but didnt see it. Did I missed anything?

Hi,

  1. Open Import > Import Scenarios
  2. Create a new Import Scenario
  3. Fill mandatory fields (use customer-list.xlsx as template)
  4. Save
  5. Select newly created scenario
  6. Click the Import button
  7. Upload customer-list.xlsx
  8. Go to the Customers browser

Regards,
Gleb

Hi
I am getting the following exception when I tried using your sample app in my own app:

java.lang.NullPointerException
at com.company.web.gen.importscenario.ImportScenarioBrowse.init(ImportScenarioBrowse.java:56)
at com.haulmont.cuba.gui.WindowManager.init(WindowManager.java:1043)
at com.haulmont.cuba.gui.WindowManager.initWrapperFrame(WindowManager.java:1032)

I would like to try the application but get the following error when importing into Cuba:

Unable to Open the Project
Unable to load the component com.haulmont.cuba:cuba-global:$cubaVersion
See Studio log for details.

Any advice?
Thanks

Hi,

I get an exception:

Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.6.2.cuba15): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class com.company.myproject.importer.entity.Importer] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:2035)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2026)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveClassTransformer.buildClassTransformers(StaticWeaveClassTransformer.java:126)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveClassTransformer.<init>(StaticWeaveClassTransformer.java:76)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.process(StaticWeaveProcessor.java:247)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.performWeaving(StaticWeaveProcessor.java:173)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeave.start(StaticWeave.java:115)
at org.eclipse.persistence.tools.weaving.jpa.CubaStaticWeave.main(CubaStaticWeave.java:35)
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.2.cuba15): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [cuba] failed.
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.6.2.cuba15): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class com.company.myproject.importer.entity.Importer] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:231)
... 8 more

And I see that, how your AbstractNotPersistentEntity class is differs from mine:
I have these:

@com.haulmont.chile.core.annotations.MetaClass(name = "sys$AbstractNotPersistentEntity") //in yours the sys$ missing
@SystemLevel(propagateToSubclasses = false) //and this is not in yours

And I can’t modify this AbstractNotPersistentEntity.

Any solution for that?

Could you upgrade the project to the current version? there are methods that are marked as deprecated.

I think the version 6.7 is coming with a better mechanism , see this link [url=]https://www.cuba-platform.com/discuss/t/component-to-facilitate-import-export-data-with-external-file[/url]

Excellent, I hope it’s included in the new release

This is work for m but not as requriement becuase i need to insert entry in different tables Like below :
table_Employee :employeeID(PK), firstname,lastname.
table_employeeDatails : empDetailID(PK),address , employeeID(FK).

can we do this to insert in multiple tables from only one excel sheet ?

Hi @bipin.ramani,

As this post is fairly old, i would like to point you to the outcome of this, which is the data import addon:

With that your requirements should be covered.

Cheers
Mario

1 Like