Quantcast
Channel: GUJ - Tópicos com a tag hibernate
Viewing all articles
Browse latest Browse all 759

Hibernate Mapeamento OneToMany com erro

$
0
0

@m.n.o escreveu:

Eu Estou tentando fazer uma relação unilateral onde uma disciplina pode ter em vários cursos, mas não quero fazer uma relação entre curso e disciplina, somente entre disciplina e curso
Classe das Disciplinas

 @Id // disciplina 
         @GeneratedValue(strategy = GenerationType.AUTO, generator = "academico.seq_tabdisc")
            @SequenceGenerator(allocationSize = 1, name = "academico.seq_tabdisc", sequenceName =         "academico.seq_tabdisc")
            @Column(name = "coddisc")
       private Integer coddisc; // codigo de descrição
@Column(name = "desdisc")
private String desdisc; // descrição
@Column(name = "hordisc")
private Integer hordisc; // carga horaria
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "codcurs", referencedColumnName = "codcurs")
private List<TabCurs> codcurs;

e essa seria a de Curso

@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "academico.seq_tabcurs")
@SequenceGenerator(allocationSize = 1, name = "academico.seq_tabcurs", sequenceName = "academico.seq_tabcurs")
@Column(name = "codcurs")
private Integer codcurs;
@Column(name = "aplcurs")
private String aplcurs; // apelido 
@Column(name = "procurs")
private Integer procurs;
@Column(name = "aticurs")
private Integer aticurs;
@Column(name = "quamese")
private Integer quamese;
@JoinColumn(name = "niveduc", referencedColumnName = "coddomi", insertable = true, updatable = true)
@OneToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
private DomEdu niveduc;

@JoinColumn(name = "codusua", referencedColumnName = "codusua", insertable = true, updatable = true)
@OneToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
private TabUsua codusua;

    @Column(name = "codfili")
private String codfili;  `

e o erro é esse

 java.lang.NullPointerException
at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1456)
at org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass(CollectionBinder.java:864)
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:779)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:728)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:70)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1695)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1424)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
at br.inf.topsoft.data.controller.HibernateUtil.conecta(HibernateUtil.java:471)
at br.inf.topsoft.toploginfx.controller.LoginController$1.call(LoginController.java:309)
at br.inf.topsoft.toploginfx.controller.LoginController$1.call(LoginController.java:295)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1423)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at javafx.concurrent.Service.lambda$null$491(Service.java:725)
at java.security.AccessController.doPrivileged(Native Method)
at javafx.concurrent.Service.lambda$executeTask$492(Service.java:724)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at br.inf.topsoft.toploginfx.controller.LoginController$2.failed(LoginController.java:408)
at javafx.concurrent.Service.lambda$new$489(Service.java:539)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
at javafx.beans.property.ObjectPropertyBase.access$000(ObjectPropertyBase.java:51)
at javafx.beans.property.ObjectPropertyBase$Listener.invalidated(ObjectPropertyBase.java:233)
at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:137)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
at javafx.concurrent.Task.setState(Task.java:696)
at javafx.concurrent.Task$TaskCallable.lambda$call$500(Task.java:1453)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)  `

detalhe quando usei mappedBy a lista veio vazia

Mensagens: 1

Participantes: 1

Ler tópico completo


Viewing all articles
Browse latest Browse all 759

Trending Articles


Hugot Lines 2020 Patama : ML Edition


Pokemon para colorear


Sapos para colorear


Maganda Quotes – tagalog Quotes – Inggit Quotes


“Tado” Jimenez Quotes Collections Online


Patama Quotes – Tanga love tagalog quotes


Mga Patama sa mga Nagmamahal the Best Tagalog love quotes for you


5 Tagalog Relationship Rules


RE: Mutton Pies (frankie241)


EASY COME, EASY GO


FORECLOSURE OF REAL ESTATE MORTGAGE


Girasoles para colorear


tagalog love Quotes – Tiwala Quotes


OFW quotes : Pinoy Tagalog Quotes


Long Distance Relationship Tagalog Love Quotes


Patama tagalog quotes – Move On Quotes


Ligaw Quotes – Courting Quotes – Sweet Tagalog Quotes


Re:Mutton Pies (lleechef)


Vimeo 10.7.0 by Vimeo.com, Inc.


Vimeo 10.7.1 by Vimeo.com, Inc.



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>