-->
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.  [ 4 posts ] 
Author Message
 Post subject: hibernate error
PostPosted: Sun Jan 23, 2005 4:13 pm 
Newbie

Joined: Sun Jan 23, 2005 3:52 pm
Posts: 2
If someone can take a moment to look at the compile error shown below, I would greatly appreciate it. I had just purchased a book, Hibernate : A Developer's Notebook (by Jim Elliott), and am going through the examples. I ran into a small issue when I try to run the "ant ctest" target. This target essentially compiles and executes the class CreateTest. The class is suppose to insert three records into the Track table. The Track.java and CreateTest.java class snippet codes in questions have been pasted below as well. Thanks.


Error

[javac] Compiling 1 source file to C:\hibernate\hworkspace\classes
[javac] C:\hibernate\hworkspace\src\com\oreilly\hh\CreateTest.java:33: cannot resolve symbol
[javac] symbol : constructor Track (java.lang.String,java.lang.String,java.sql.Time,java.util.Date,short)
[javac] location: class com.oreilly.hh.Track
[javac] Track track = new Track("Russian Trance",
[javac] ^
[javac] C:\hibernate\hworkspace\src\com\oreilly\hh\CreateTest.java:39: cannot resolve symbol
[javac] symbol : constructor Track (java.lang.String,java.lang.String,java.sql.Time,java.util.Date,short)
[javac] location: class com.oreilly.hh.Track
[javac] track = new Track("Video Killed the Radio Star",
[javac] ^
[javac] C:\hibernate\hworkspace\src\com\oreilly\hh\CreateTest.java:46: cannot resolve symbol
[javac] symbol : constructor Track (java.lang.String,java.lang.String,java.sql.Time,java.util.Date,short)
[javac] location: class com.oreilly.hh.Track
[javac] track = new Track("Gravity's Angel",



CreateTest.java snippet

Code:
try {
            // Create some data and persist it
            tx = session.beginTransaction();

            Track track = new Track("Russian Trance",
                                    "vol2/album610/track02.mp3",
                                    Time.valueOf("00:03:30"), new Date(),
                                    (short)0);
            session.save(track);

            track = new Track("Video Killed the Radio Star",
                              "vol2/album611/track12.mp3",
                              Time.valueOf("00:03:49"), new Date(),
                              (short)0);
            session.save(track);


             track = new Track("Gravity's Angel",
                              "vol2/album175/track03.mp3",
                               Time.valueOf("00:06:06"), new Date(),
                               (short)0);
            session.save(track);

            // We're done; make our changes permanent
            tx.commit();



Track.java snippet

Code:
package com.oreilly.hh;

import java.io.Serializable;
import java.util.Date;
import org.apache.commons.lang.builder.ToStringBuilder;


/**
*       Represents a single playable track in the music database.
*       @author Jim Elliott (with help from Hibernate)
*     
*/
public class Track implements Serializable {

    /** identifier field */
    private Integer id;

    /** persistent field */
    private String title;

    /** persistent field */
    private String filePath;

    /** nullable persistent field */
    private Date playTime;

    /** nullable persistent field */
    private Date added;

    /** nullable persistent field */
    private Short volume;

    /** full constructor */
    public Track(String title, String filePath, Date playTime, Date added, Short volume) {
        this.title = title;
        this.filePath = filePath;
        this.playTime = playTime;
        this.added = added;
        this.volume = volume;
    }


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 23, 2005 4:16 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This is very likely a question for the author of the book, try to email him or use the forum or whatever O'Reilly has to offer. I have seen many conceptual and technical mistakes in this book, you should always verify what he wrote with the refernce documentation.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 23, 2005 4:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is just a bug, nothing to do with hibernate. The constructor takes a Short, you are passing a short


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 23, 2005 5:15 pm 
Newbie

Joined: Sun Jan 23, 2005 3:52 pm
Posts: 2
Thanks Mike! I must have overlooked this somehow.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.