-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Hibernate default constructor - every class must have...erro
PostPosted: Tue Jan 27, 2004 12:34 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
I get the following error though my AnalysisData.java class
file has a constructor.any help appreciated. thanks

AnalysisData.java class
public class AnalysisData {
private long id = -1l;
private TestData data;
private ActivityTModule test;
private AnalysisResult result;
private int type;
private String info;

public AnalysisData() {}

net.sf.hibernate.PropertyNotFoundException:
Object class must declare a default (no-argument) constructor reflection optimizer disabled for hibernate


2004-01-27 09:17:51,844 [main] INFO net.sf.hibernate.util.ReflectHelper - reflection optimizer disabled for: com.dynetics.vidrds.model.DurabilityTest, IllegalAccessError: tried to access method com.dynetics.vidrds.model.DurabilityTest.<init>()V from class com.dynetics.vidrds.model.DurabilityTestMetaClass1
net.sf.hibernate.PropertyNotFoundException: Object class com.dynetics.vidrds.model.AnalysisData must declare a default (no-argument) constructor
at net.sf.hibernate.util.ReflectHelper.getDefaultConstructor(ReflectHelper.java:304)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 12:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
It is complaining about com.dynetics.vidrds.model.DurabilityTest not the one you posted.


Top
 Profile  
 
 Post subject: Re:default constructor - illegal access error
PostPosted: Tue Jan 27, 2004 1:20 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
Thanks for the quick reply
When its saying the following

IllegalAccessError: tried to access method com.dynetics.vidrds.model.DurabilityTest.<init>()V from class com.dynetics.vidrds.model.DurabilityTestMetaClass1


I am curious what this meta class is...DurabilityTestMetaClass1
And in my DurabilityTest class, I am doing the regular stuff like the following (still cant figure out what the error is...)


public class DurabilityTest {
private long id = -1;
private String name;
private long version;
private Set testModules;
public DurabilityTest(String name) {
this.name = name;
this.version = System.currentTimeMillis();
}
private DurabilityTest() {}
public void addTestModule(TestModule module) {
testModules.add(module);
}
public void removeTestModule(TestModule module) {
testModules.remove(module);
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 1:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well you don't have a no-arg constructor accessible for hibernate here, and I suspect this class is somehow associated with your other classes.


Top
 Profile  
 
 Post subject: Default Hibernate Constructor
PostPosted: Tue Jan 27, 2004 3:11 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
Thanks again.
private DurabilityTest() {}

is in my class an I tried changing it to protected and public to make it visible to Hibernate.still no luck...

wondering anything else that i need to change here

regards,
samy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 6:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
and with protected/public you still get the same exception?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 7:01 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
yes, surprisingly


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 28, 2004 3:42 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
Seems I found the fix
I changed the constructor to be protected and setter methods' visibility to public.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.