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 in entity-update.html #118

Closed
normyx opened this issue Jul 1, 2019 · 5 comments
Closed

Error in entity-update.html #118

normyx opened this issue Jul 1, 2019 · 5 comments

Comments

@normyx
Copy link

normyx commented Jul 1, 2019

When referencing a many-to-one relationship, the formControlName is invalid and causes error:

ERROR Error: Cannot find control with name: 'taskProject'
    at _throwError (forms.js:2144)
    at setUpControl (forms.js:2052)
    at FormGroupDirective.push../node_modules/@angular/forms/fesm5/forms.js.FormGroupDirective.addControl (forms.js:5281)
    at FormControlName.push../node_modules/@angular/forms/fesm5/forms.js.FormControlName._setUpControl (forms.js:5882)
    at FormControlName.push../node_modules/@angular/forms/fesm5/forms.js.FormControlName.ngOnChanges (forms.js:5803)
    at checkAndUpdateDirectiveInline (core.js:22095)
    at checkAndUpdateNodeInline (core.js:23363)
    at checkAndUpdateNode (core.js:23325)
    at debugCheckAndUpdateNode (core.js:23959)
    at debugCheckDirectivesFn (core.js:23919)

Seems to change in my case formControlName="taskProject" to formControlName="taskProjectId" in the HTML file solves the issue.

@mraible
Copy link
Collaborator

mraible commented Jul 9, 2019

I need more information to reproduce and fix this issue. Do you have a JDL for your JHipster project? If not, can you run jhipster info and paste the contents here? Also, please include the commands to generate the entities where the issue happens.

@normyx
Copy link
Author

normyx commented Jul 9, 2019

Hi @mraible ,

the JDL is the one in #104 .

@mraible
Copy link
Collaborator

mraible commented Jul 24, 2019

@normyx I tried to reproduce this using a default JHipster 6.1.2 app. I'm unable to get past the "Task Projects" screen in Ionic because there's an error on the server.

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "PROFIL" not found; SQL statement:
select owners0_.workspace_id as workspac1_21_0_, owners0_.owner_id as owner_id2_21_0_, profil1_.id as id1_5_1_, profil1_.display_name as display_2_5_1_, profil1_.photo as photo3_5_1_, profil1_.photo_content_type as photo_co4_5_1_, profil1_.user_id as user_id5_5_1_, user2_.id as id1_3_2_, user2_.created_by as created_2_3_2_, user2_.created_date as created_3_3_2_, user2_.last_modified_by as last_mod4_3_2_, user2_.last_modified_date as last_mod5_3_2_, user2_.activated as activate6_3_2_, user2_.activation_key as activati7_3_2_, user2_.email as email8_3_2_, user2_.first_name as first_na9_3_2_, user2_.image_url as image_u10_3_2_, user2_.lang_key as lang_ke11_3_2_, user2_.last_name as last_na12_3_2_, user2_.login as login13_3_2_, user2_.password_hash as passwor14_3_2_, user2_.reset_date as reset_d15_3_2_, user2_.reset_key as reset_k16_3_2_ from workspace_owner owners0_ inner join profil profil1_ on owners0_.owner_id=profil1_.id left outer join jhi_user user2_ on profil1_.user_id=user2_.id where owners0_.workspace_id=? [42102-199]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:451)
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:427)
	at org.h2.message.DbException.get(DbException.java:205)
	at org.h2.message.DbException.get(DbException.java:181)
	at org.h2.command.Parser.readTableOrView(Parser.java:7146)
	at org.h2.command.Parser.readTableFilter(Parser.java:1895)
	at org.h2.command.Parser.readJoin(Parser.java:2293)
	at org.h2.command.Parser.parseJoinTableFilter(Parser.java:2653)
	at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:2642)
	at org.h2.command.Parser.parseSelectSimple(Parser.java:2788)
	at org.h2.command.Parser.parseSelectSub(Parser.java:2636)
	at org.h2.command.Parser.parseSelectUnion(Parser.java:2469)
	at org.h2.command.Parser.parseSelect(Parser.java:2440)
	at org.h2.command.Parser.parsePrepared(Parser.java:814)
	at org.h2.command.Parser.parse(Parser.java:788)
	at org.h2.command.Parser.parse(Parser.java:760)
	at org.h2.command.Parser.prepareCommand(Parser.java:683)
	at org.h2.engine.Session.prepareLocal(Session.java:627)
	at org.h2.engine.Session.prepareCommand(Session.java:565)
	at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1292)
	at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:77)
	at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:349)
	at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:311)
	at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)
	at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
	... 190 common frames omitted

Here's the .yo-rc.json from my JHipster app:

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "org.jhipster.blog",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.1.2",
    "applicationType": "monolith",
    "baseName": "jhipster",
    "packageName": "org.jhipster.blog",
    "packageFolder": "org/jhipster/blog",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "ZDI0ZDUxMmE4YTNlMjcyYjgyMTA4ZmY4MWFlNmI4ODBhZWI5NTZjNmY2ZDE1MjdhYjQ1MTQ3MTYwMzk2YTRiYjQ2ODVlNDM2Y2E3NDZmNDI5OTE0NzhkNmQzMDEyMGFkOGRhZDhmNTMxOTJmOGVmMWE4YWU4NTNmZWZlOGYxYzE=",
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": ["en"]
  }
}

Here's the JDL I'm importing:

entity Workspace {
  label String required minlength(5) maxlength(40)
}
entity Wallet {
  label String required minlength(5) maxlength(400)
}
entity SpentConfig {
  label String required minlength(2) maxlength(40)
}
entity SpentSharingConfig {
  share Float required
}
entity Spent {
  label String required minlength(2) maxlength(100),
  amount Float required,
  spentDate LocalDate required,
  validated Boolean required
}
entity SpentSharing {
  amountShare Float required,
  share Float required
}
entity SpentRecurrence {
  amount Float required,
  recurrenceFrom LocalDate required,
  recurrenceTo LocalDate,
  dayInMonth Integer required min(1) max(31)
}
entity TaskProject {
  label String required minlength(5) maxlength(40)
}
entity Task {
  label String required minlength(5) maxlength(40),
  description String maxlength(4000),
  done Boolean required,
  dueDate LocalDate,
  priority Integer required min(0) max(4)
}
entity ShoppingList {
  label String required minlength(5) maxlength(100)
}
entity ShoppingItem {
  label String required minlength(2) maxlength(100),
  done Boolean required
}
entity Profil {
  displayName String required,
  photo ImageBlob
}
relationship OneToOne {
  SpentRecurrence{spent(label) required} to Spent{recurrence},
  Profil{user(login)} to User
}
relationship OneToMany {
  Workspace{wallet} to Wallet{workspace(label)},
  Wallet{defaultSpentConfig} to SpentConfig{wallet(label)},
  SpentConfig{defaultSpentSharingConfig} to SpentSharingConfig{defaultSpentConfig},
  Wallet{spent} to Spent{wallet(label)},
  Spent{sharing} to SpentSharing{spent(label)},
  Workspace{taskProject} to TaskProject{workspace(label)},
  TaskProject{task} to Task{taskProject(label)},
  ShoppingList{item} to ShoppingItem{list(label)}
}
relationship ManyToOne {
  SpentSharingConfig{sharingUser(displayName)} to Profil,
  Spent{spender(displayName)} to Profil,
  SpentSharing{sharingUser(displayName)} to Profil
}
relationship ManyToMany {
  Workspace{owner(displayName)} to Profil{workspace(label)},
  Wallet{owner(displayName)} to Profil{wallet},
  TaskProject{owner(displayName)} to Profil{taskProject},
  Task{owner} to Profil{task},
  ShoppingList{owner(displayName)} to Profil{shoppingList}
}

dto Workspace, Wallet, SpentConfig, SpentSharingConfig, Spent, SpentSharing, SpentRecurrence, TaskProject, Task, ShoppingList, ShoppingItem, Profil with mapstruct
paginate Workspace, Wallet, Spent, TaskProject, Task, Profil with infinite-scroll
service Workspace, Wallet, SpentConfig, SpentSharingConfig, Spent, SpentSharing, SpentRecurrence, TaskProject, Task, ShoppingList, ShoppingItem, Profil with serviceClass
filter Workspace, Wallet, SpentConfig, SpentSharingConfig, Spent, SpentSharing, SpentRecurrence, TaskProject, Task, ShoppingList, ShoppingItem, Profil

@mraible
Copy link
Collaborator

mraible commented Jul 24, 2019

I'm guessing this one will be easier to test and fix when import-jdl is implemented. I'm currently tracking that at #29.

@mraible
Copy link
Collaborator

mraible commented Sep 9, 2019

I just tried this JDL with JHipster 6.2.0 and this fix to add import-jdl. I'm happy report that everything compiles and works!

@mraible mraible closed this as completed Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants