Who can solve this difficult problem?

I have written a java program:
import java.util.*;
class Test0 {
public static void main(String[] args) {
LinkedList[] Cate= new LinkedList[4];
(Cate[0]).add(0,"cat");
(Cate[0]).add("kate");
System.out.println(Cate[0]);
Cate[2].add("dog");
Cate[2].add("girl");
for(int i=0;i<4;i++){
Cate.add("boy");
System.out.println(Cate[i]);
} // end of main class
// end of class
But i can not run it correctly,why?

No, I can not compile it correctly:
import java.util.*;
class Test0 {
public static void main(String[] args) {
class Point{
public int x=2;
public int y=5;
LinkedList[] Cate= new LinkedList[4];
// according your advice:
for(int i=0;i<4;i++){
Cate = new LinkedList();
Point x1 = new Point();
Point x2 = new Point();
Cate[0].add(x1);
Cate[0].add(x2);
Cate[2].add("dog");
Cate[2].add("girl");
System.out.println( ((Point)(Cate[0].get(0)) ).x );
System.out.println( ((Point)(Cate[0].get(0)) ).y );
System.out.println( ((Point)(Cate[0].get(1)) ).x );
System.out.println( ((Point)(Cate[0].get(1)) ).y );
for(int i=0;i<4;i++){
//Cate.add("boy");
System.out.println(Cate[i]+" "+Cate[i].size() );
I got this:
[xwl@zhyj_12 Test.old]$ javac Test0.java
Test0.java:13: incompatible types
found : java.util.LinkedList
required: java.util.LinkedList[]
Cate = new LinkedList();
^
1 error
But Ragnvald told me another method yestoday,it works perfectly, And I appreciate him. His code like this:
import java.util.*;
class Test0 {
public static void main(String[] args) {
class Point{
public int x=2;
public int y=5;
LinkedList[] Cate= new LinkedList[4];
// The difference is Cate or Cate[i] !!!!
for(int i=0;i<4;i++){
Cate[i] = new LinkedList();
Point x1 = new Point();
Point x2 = new Point();
Cate[0].add(x1);
Cate[0].add(x2);
Cate[2].add("dog");
Cate[2].add("girl");
System.out.println( ((Point)(Cate[0].get(0)) ).x );
System.out.println( ((Point)(Cate[0].get(0)) ).y );
System.out.println( ((Point)(Cate[0].get(1)) ).x );
System.out.println( ((Point)(Cate[0].get(1)) ).y );
for(int i=0;i<4;i++){
//Cate[i].add("boy");
System.out.println(Cate[i]+" "+Cate[i].size() );

Similar Messages

  • See who can solve this problem

    Parameter name   || Typing     ||  Associated Type
    ACGL_ITEM         || Structure ||  ACGL_ITEM
    this give error ( Typing is only for Like,Type,Type Ref To )
    therefore i change it to Type
    but it telling me that the ( TABLES parameters are obsolete!)
    guys what can i do, is there a solution to solve this problem??
    Thank you.
    Edited by: guanwei su on Mar 10, 2008 7:05 AM

    The following code might be helpful:
    TYPES: types_t_acgl_item TYPE STANDARD TABLE OF acgl_item.
    DATA: gt_acgl_item TYPE types_t_acgl_item.
    PERFORM sub_perform USING gt_acgl_item.
    *&      Form  SUB_PERFORM
    *       text
    *      -->UT_ACGL_ITEM  test Table
    FORM sub_perform USING ut_acgl_item TYPE types_t_acgl_item.
    ENDFORM.                    " SUB_PERFORM
    Hope That Helps
    Anirban M.

  • Zombie email message won't die! $1 bounty to anyone who can solve this.

    I have a message that absolutely will not die. I've tried everything I can think of to delete it, but it keeps coming back. I've tried moving it from one mailbox to another, killing it with the delete key, killing it by cutting it (Command-X), but it lingers on. At this point, it only shows up in the index with a subject and date, but the content of the message is gone. I've tried rebuilding the mailboxes a number of times, but it always reappears. I've tried logging into my various accounts through the web interface, but it doesn't exist on the servers anywhere, it's only local as far as I can see.
    In my last attempt to get rid of it, I scanned my ENTIRE HARD DRIVE for the string of text containing the subject line using grep, and narrowed it down to a few files in the ~/Library/Mail folder, which I deleted through the Terminal using rm. I then re-opened Mail and rebuilt the mailboxes, and the email STILL appears. It will no longer let me move the message to another mailbox, however, but I can't get the damned thing to disappear.
    I will PayPal $1 to anyone who can come up with a solution that doesn't involve recreating my Mail accounts. May the game begin!

    Hello,
    Are you using an IMAP or POP account?
    Anything you do in the Terminal, Finder or some third party Mail app enhancers will very often mess up the index, which appears to be a symptom of.
    I think you should force a reindexing by deleting the Envelope Index. With IMAP or Exchange account, forcing reindexing requires removing the account folder. See:
    http://docs.info.apple.com/article.html?path=Mail/4.0/en/14019.html
    Ask any questions needed to get comfortable with doing this.
    Ernie

  • URGENT! deadline today : [   £10 to anyone who can solve this!

    I hope people don't mind me offering this as a token of my gratitude, should someone be able to resolve this-
    I'm completely stuck now and feel powerless, unable to finish this edit because of this technical problem...
    Basically, when I apply Time Remapping to a nested sequence, it becomes black from about halfway through, onwards. If I disable Mercury Playback Engine, it solves this issue and the blackness is replaced by the remainder of the clip but other problems happen (edge feathering suddenly isn't possible[!?] and obviously performance)
    Not sure if it's directly related but if I apply a new Edge feather it curiously slips clips back or forward a few frames..
    Here's the video I made illustrating the issue:
    https://www.youtube.com/watch?v=HOspXIKSnNw
    Thanks so much for any help or ideas : ]
    Luke

    Ah.
    Thanks Harm.
    I think there should be a law stipulating that companies like Adobe must make it clear when a feature in their (pretty expensive) product doesn't work properly, so people like me don't stuck in a situation where they have a deadline they risk not meeting because the software doesn't work as advertised...
    I'll have a think about a workaround I guess.. maybe something in After Effects..

  • I will give $100 to the person who can solve this problem once and for all.

    I'm not even kidding, dude. We can do PayPay, I'll mail you a check, whatever you want. That is how frustrating this is, that is how badly I want it fixed, and that is how much overtime I've worked lately thanks to being shorthanded at my place of biz-nass. I'm an hombre of my word, so if you actually come up with a solution that works, the cheddar will be yours. Okay let's hit it.
    It's the skipping thing. First 10-12 seconds of a song - every song - will play fine, then iTunes skips, stutters, and basically does the god **** hokey pokey and shakes it all about. It happens most notably with songs that I double-click to play, but I'm pretty much noticing it on any song now after a transition is made. I've been using iTunes for ages and this didn't happen until the upgrade to 7.3. I have poured over these forums for nearly a week, tried every solution offered (even offered one of my own that actually worked for maybe four days before the whole thing started up again) and NOTHING. To save us all some time, here's what I've tried:
    - Downgrading. I'll admit I didn't do this correctly at first. I didn't remove everything according to the support guidelines, but I went down to version 6.05 and that did nothing to quell the skipping. I upgraded back up to 7.3 because hey, why not, and attempted the remaining trial fixes. I have since removed both iTunes and Quicktime, step my step according the the guidelines, and not only have I downgraded to my current running version of 7.2, I put both of the programs on my F drive (as opposed to the default C drive), my gigantic bonus internal drive where I typically keep nothing but my giganto music library. I thought putting the app on the same drive as the music might fix things. I thought wrong. Dead wrong. Dead diddly dum iddly wrong.
    - Quicktime settings. My settings for Quicktime have always been in safe mode with the output size at 16 bits. So when I saw this "fix" I just rolled my eyes. I used to have that dealio back in the dizzle when iTunes would just get all static-y and skip when I'd open other programs or even just minimize it, so that fix worked for that, but it's nothing compared to this. In simpler terms, that fix is like Superman, and this skipping? The kryptonite. Actually that's probably not a great metaphor, but we've got a ways to go and this is going to get mucho boring if I don't throw some chuckles out there. Ready for fix three? Giddy up!
    - Turn off cross-fade? It's never been on. I never really got the appeal of that, and also I think it resulted in some minor skipping back in the d. I also attempted similar fixes like turning off the equalizer, messing with the volume, closing last.fm, REMOVING an old album art retrieval program from back before iTunes got its **** together with album art, ANYTHING that might interfere with playback was turned off, removed, b-slapped, and sent crying home to its moms. Nada.
    - Recreating my library. This was the fix I offered someone else, because it actually did the trick for a few days. After an entire night spent reimporting 73 gigs worth of music, it played fine, but I did lose a ton of album art, playcounts, etc, so you can imagine how ****** I was when this wound up not being a permanent fix. I was beyond ******. I was livid. But I was taught in the dojos of my youth to channel my anger into productivity, and instead of sculpting a lovely bonsai tree, I set out to fix this pup once and for all.
    - That darn anti-virus! This was the final fix I tried, even though I wasn't using any of the culprit programs listed in the forums as causes of the skipping, and even those offering this as a solution confessed it was pretty hit or miss. But having tried everything else, having resorted to playing my music on MediaMonkey of all things, I figured I'd give it a shot. I used (reason for the past-tense forthcoming) AVG Anti-Virus, Lavasoft AdAware and something called Spyware Doctor that I think just came bundled with XP. I removed all of them. I had just done a virus scan recently to see if that's what was causing this, so I figured I'd be okay until I could redownload them after this fix wound up not working. And it didn't work, so there's that.
    There may be a couple of fixes I've tried that I'm forgetting now, since I'm delirious after spending practically every night for the past week trying to fix this problem, while my girlf, Heather, sits and laughs at me while watching Clark and Michael on her MacBook. In fact, she's laughing at the $100 offer as I type this, but I assure you, if you offer a solution that works, the money is as good as yours. If you come up with a workable solution, I'll have to test and make sure it isn't temporary like the recreating my library thing, but I won't leave you hanging once I'm satisfied that it's fixed for good. I know it's unorthodox, perhaps illegal in some states, but I'm desperate here, peeps. The ball is in your court, and I beg you not to give up the rock.
    Gateway E-2000 Windows XP

    I think the problem lays with Last.fm. I had the same exact problem as you. In your processes screen, end the task "lastfmhelper.exe" Last.fm still scrobbles. The tracks don't skip, although I notice there is still a bit of a lag in the first part of the song - but if you can deal with that, no skipping. I think you will have to end that task everytime you boot up your computer, or uninstall last.fm completely until they fix it; it is a bug in their software, as opposed to iTunes.

  • See who can  solve this problem 2

    today i going to do BDC Recording.
    however i face a problem after insert all the things it needed.
    Here the problem come, when i push on a pushbutton (PARK) the recording pop out a error.
    the error is :
    PARK is not possible in bdc recording.
    can anyone help me out?
    Thanks you so much ^^.

    Hi,
    ya i know the BDC_OKCode is '=BP'
    i had try that out but when i go to SM35 and try to process it and the result is fail ( nothing wrong with my code because when BP change to BU the whole thing run successfully )
    because ( parking is not prossible during batch input)
    Thanks
    Guanwei

  • Who can solve this problem?

    Repeat message
    I have 2 same servers on sun.
    I update data on first www server and I want to have updated data on second
    www server (to have save backup server). How to do this?
    Thanks for answer. Sorry for my bad English.
    Piotr

    Piotr Kowalski wrote:
    Repeat message
    I have 2 same servers on sun.
    I update data on first www server and I want to have updated data on second
    www server (to have save backup server). How to do this?
    Thanks for answer. Sorry for my bad English.rsync would work, or you could have your document root nfs mounted from one
    machine to the other.
    Kent

  • Is there anybody who can solve this

    I have seen so many query related to this on this forum, But i have not seen single satisfactory answer for the same.
    This is really disappointing. Despite of so many experts are there this is remained unsolved.
    Let me try once again, This is Printing problem in D2k Reports, Where I am using 150 column report, It works fine on 98,NT but i try the same from 2000 or XP platform it doesn't comes properly. Almost 80-90 character print in one line and rest goes in next line.
    Thanks
    Shital

    Dear Sir,
    Of course i responsible to solve my problem, but if i am not able to solve than only i forward on this forum and if nobody able to solve than who is responsible??
    Any way, here i am puting some info.
    Mode : Client/Server
    reports-version : 6.0.8.26.0
    Desired output-format : Character mode
    Pagesize : In report 8.5-11(W-H), In PRT file width is 150 defined.
    The report works fine on Win98 and create problem on 2K and XP.
    Thanks
    Vishal

  • Any Mac expert who can solve my Printing problem? PLEASE HELP!!!!

    So I am asking this again... I have a Samsung 4200 SCX Series printer. It was able to print everything properly till the 14th of April when I installed the latest Security update and the thing stopped working after that (When I give a print command, it just Pauses.... Then when I resume it again, it doesn't respond, just stays there) ... I also noticed that the name of my Mac changed to XXX (3) from XXX (2) after that update, so I am thinking it's the culprit here.. I dunno if it's related, but I just thought I put it forward.
    I also went to Printer and Fax settings in my System Preferences and reseted my Printer and changed the LOCATION name to the new name but no solution... I tried even installing the drivers manually, but the thing just PAUSES!!!!
    And before doubting my printer, I also have Windows installed via bootcamp and the printer works fine with it, it's only the Mac creating an issue.
    I got some response of people asking for the log file about it, so I am posting the last 10-20 line...
    ------->
    E [01/May/2010:10:18:36 +0530] CUPS-Add-Modify-Printer: Unauthorized
    I [01/May/2010:10:18:36 +0530] Setting SamsungSCX_4200Series device-uri to "usb://Samsung/SCX-4200%20Series?serial=8T67BAIP221002W." (was "file:/dev/null".)
    I [01/May/2010:10:18:36 +0530] Setting SamsungSCX_4200Series printer-is-accepting-jobs to 1 (was 0.)
    I [01/May/2010:10:18:36 +0530] Setting SamsungSCX_4200Series printer-state to 3 (was 5.)
    I [01/May/2010:10:18:36 +0530] Saving printers.conf...
    I [01/May/2010:10:18:36 +0530] New printer "SamsungSCX_4200Series" added by "AUTHREF".
    I [01/May/2010:10:18:36 +0530] Setting SamsungSCX_4200Series printer-is-shared to 1 (was 1.)
    I [01/May/2010:10:18:36 +0530] Saving printers.conf...
    I [01/May/2010:10:18:36 +0530] Printer "SamsungSCX_4200Series" modified by "AUTHREF".
    I [01/May/2010:10:19:09 +0530] [Job ???] Request file type is application/pdf.
    I [01/May/2010:10:19:09 +0530] [Job 1] Adding start banner page "none".
    I [01/May/2010:10:19:09 +0530] [Job 1] Adding end banner page "none".
    I [01/May/2010:10:19:09 +0530] [Job 1] File of type application/pdf queued by "chintanvora".
    I [01/May/2010:10:19:09 +0530] [Job 1] Queued on "SamsungSCX_4200Series" by "chintanvora".
    I [01/May/2010:10:19:09 +0530] [Job 1] Started filter /usr/libexec/cups/filter/cgpdftoraster (PID 452)
    I [01/May/2010:10:19:09 +0530] [Job 1] Started filter /usr/libexec/cups/filter/rastertoqpdl (PID 453)
    I [01/May/2010:10:19:09 +0530] [Job 1] Started backend /usr/libexec/cups/backend/usb (PID 454)
    E [01/May/2010:10:19:09 +0530] PID 454 (/usr/libexec/cups/backend/usb) crashed on signal 10!
    I [01/May/2010:10:19:09 +0530] Hint: Try setting the LogLevel to "debug" to find out more.
    I [01/May/2010:10:19:10 +0530] [Job 1] Backend returned status -10 (crashed)
    I [01/May/2010:10:19:10 +0530] Saving printers.conf...
    *E [01/May/2010:10:21:41 +0530] Resume-Printer: Unauthorized*
    I [01/May/2010:10:21:41 +0530] Saving printers.conf...
    I [01/May/2010:10:21:41 +0530] Printer "SamsungSCX_4200Series" started by "chintanvora".
    Oh and it's connected via USB, not the network...
    It still baffles me cause I have searched and the only people getting this issue are the one's who use a printer via bonjour or online.. I AM USING A FREAKING USB AND IT's NOT PRINTING!!!!
    PLEASE HELP if you can... I can't replace my printer or re-install the OS just for this crap...
    MacBook Air running on Mac OS X 10.5.8

    Hey Rodney, the name changed after I installed the latest security patch... And it's not only me, it's a common problem.. Here check it out...
    http://discussions.apple.com/thread.jspa?threadID=2319594&tstart=0
    I wish I never installed that security update...
    And what exactly does this deleting System pref files does??? What does setting up network again imply... You mean just adding the password and selecting the net name of my wifi don't you?? Cause I would hate to reset all those MAC address and other stuff (I really don't have much knowledge about those so wouldn't like to tamper with those).
    Anyways, thanks.

  • Any expert JDBC developer who can solve this mystery?

    I am trying to access database in SQL Server7.0 using Java.Name of the database is "DatabaseName".I have used following syntax but it is giving me errors.
    private String URL = "jdbc:odbc:DatabaseName";
    private String userName="user";
    private String passWord="password";
    Class.forName( "sun.jdbc.odbc.jdbcOdbcDriver" );
    connection = DriverManager.getConnection( URL,userName,"passWord" );
    where "username" and "password" are user Name and password respectively to access the database in SQL Server 7.0. And I have used the same name in "ODBC data source" as that of the database.I am trying some examples from book and these examples just work fine with MS Access( I created those databases in Access and tried the examples) but the same examples with databases in SQL Server 7.0 are not working.I made appropriate changes in DSN names and the code. Do I need a separate driver or something?

    This
    connection = DriverManager.getConnection(URL,userName,"passWord" );should be
    connection = DriverManager.getConnection(URL,userName,passWord );You want to pass the variable password in, not a constant string.
    If you have other problems post the actual error message you get so that people can see what problem you are getting.
    Col

  • Nobody can solve this DBMS_LOB problem:

    I want to upload text file to ftp server but when i open file mcx.txt which is in e:\middle-east\ssm dmbs_lob.fileopen() function give error. edit e:\middle-east\ssm\mcx.txt; command also open this text file properly.
    ORA-22285: non-existent directory or file for FILEOPEN operation
    ORA-06512: at "SYS.DBMS_LOB", line 523
    ORA-06512: at "SCOTT.FTP", line 128
    ORA-06512: at "SCOTT.FTP", line 355
    ORA-06512: at line 7
    FUNCTION get_local_ascii_data (p_dir IN VARCHAR2,
    p_file IN VARCHAR2)
    RETURN CLOB IS
    l_bfile BFILE;
    l_data CLOB;
    BEGIN
    DBMS_LOB.createtemporary (lob_loc => l_data,
    cache => TRUE,
    dur => DBMS_LOB.call);
    l_bfile := BFILENAME(p_dir, p_file);
    DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
    DBMS_LOB.loadfromfile(l_data, l_bfile, DBMS_LOB.getlength(l_bfile));
    DBMS_LOB.fileclose(l_bfile);
    RETURN l_data;
    END;

    Just for the sake of clarification ... What value are you specifying for p_dir variable?
    It should be a directory object created in the database.
    It can be created with a command like
    CREATE OR REPLACE DIRECTORY BFILE_DIR AS 'e:\middle-east\ssm';
    and the user who is going to call the function should have read access on this directory object which can be granted with a command like
    grant read on directory BFILE_DIR to FUNCTIONCALLINGUSER;
    I hope this helps with what you are trying
    Best Regards

  • [Desperate] Our company will pay if you can solve this memory problem!

    We have a java program running in linux. The problem with this program is that it's memory usage keep increasing in size and does not stop. Eventually all the swap space will be used and the system dies. However, here is the key, the heap usage DOES NOT INCREASE. We cannot figure this out. What could the problem here?
    Heap Usage shown by profile: cycles between 450-500Mb. VM was set to havea 600Mb limit
    Total memory usage 6Gb shown by the unix utility top and growing.

    sabre150 wrote:
    Yarlag wrote:
    sabre150 wrote:
    Yarlag wrote:
    I'm sorry we can provide any information as need, but we are really just not sure where to start.
    1) We do not use any runtime.exec
    2) No native libraries
    3) We have no file I/O but plenty of network I/OI doubt if I can really help but if you close the program before running out of swap space is the memory returned?Yes if I close the program, all memory (both resident and in swap) is returned to the OS.So as I initially surmised, you seem to have a native method memory leak. How you find it I don't know.
    What version of Java are you using?
    Are you using one the the non-Sun Java abominations such as gcj or Openjdk? If so then don't .
    Edited by: sabre150 on Sep 29, 2009 8:46 PM1) How do you come to the conclustion that I have a native method memory leak? No evidence suggests that and we know that we do not use any native method.
    2) 1.6
    3) Sun's JVM

  • Any body who can solve this

    Let me detail my schema i.e I have four tables
    1. ic_store: have storeCode,Description columns.
    2. ic_subStore: substoreCode,Description.
    3. ic_item: itemCode,storeCode(F.K),substoreCode(F.K),Description and others.
    4. ic_itemBal: itemCode,and Balances columns.
    Now I want to give my report the look as,
    Store\SubStore Item Description
    S0001 Main Gold Store
    SB0001 Sub Gold Store.
    ITM00001 Pure Gold 24 Kt.
    and so on.
    After Description Column another column for
    item balances.
    My Query:
    First Query :taking data from ic_store i.e storeCode and description.
    Second Query :taking data from ic_subStore'columns.
    Third Query :taking data from ic_item for item and its description and also taking data from ic_itemBal for balances.
    Problem : is that I have two parameters asking for--- from item to item
    but when I choose these parameters also store those have no items still defined appears and just take spaces.I want to remove those store which have no items defined still.
    Please let me know if I have conveyed my problem properly.
    Thanx in advance.
    null

    See if this works :
    Select t3.store_code, t1.description, t3.substoreCode, t2.Description,t3.itemcode, t3.description,t4.balances
    From ic_store t1, ic_substore t2, ic_item t3,
    ic_itemBal t4
    Where t3.store_code = t1.store_code
    And t3.substoreCode = t2.substorecode
    And t3_itemcode is not null
    And t3_itemcode between(:param1,:param2);
    I think this should work.

  • 10 points to the first whiteknight who can fix this simple problem

    Hello team,
    I'm working with this excellent Flash grid gallery for my current project, however, I've reached a snag.
    Instead of using a hex as the image background (currently set to #FFFFFF in the .xml), i'd like to use a moving gif, to give the transition a little more life. Is this possible, and simpler than I'm finding it to be?
    Other items on my wishlist of mods would be to remove the 'loading x of x thumbnails bar in the corner' and not requiring a second click to view a photo's desciption once it's been selected from the grid.
    I would appreciate anyone's help in this matter greatly.
    Best

    You can import an animated gif, but it will not remain intact as one such that you can drop it onto the stage and have it play.  What you can do is create a new movieclip symbol and while it is open for editing import the animated gif to the stage. 
    The frames of the animated gif will be planted sequencially in the timeline, with some attempt at automatically getting the timing correct via extending frames occupied by each panel of the animated gif.  At this point you will have a movieclip representation of the animated gif that you can place in the background.

  • Who can solve my problem? My problem in below.

    Who can solve my problem? My problem in below.

    hi,my problem now is :
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
         net.sf.hibernate.examples.quickstart.HibernateUtil.currentSession(HibernateUtil.java:24)
         org.apache.jsp.testCat_jsp._jspService(testCat_jsp.java:65)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    package net.sf.hibernate.examples.quickstart;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import net.sf.hibernate.*;
    import net.sf.hibernate.cfg.*;
    public class HibernateUtil {
    private static Log log = LogFactory.getLog(HibernateUtil.class);
    private static SessionFactory sessionFactory ;
    static {
    try {
    // Create the SessionFactory
    sessionFactory = new Configuration().configure().buildSessionFactory();
    catch (Throwable ex) {
    log.error("Initial SessionFactory creation failed.", ex);
    System.out.println(ex.toString());
    public static final ThreadLocal session = new ThreadLocal();
    public static Session currentSession() throws HibernateException {
    Session s = (Session) session.get();
    // Open a new Session, if this Thread has none yet
    if (s == null) {
    s = sessionFactory.openSession();
    session.set(s);
    return s;
    public static void closeSession() throws HibernateException {
    Session s = (Session) session.get();
    session.set(null);
    if (s != null)
    s.close();
    }

Maybe you are looking for

  • Credit Memo Request in VA01

    Dear, Process : Actually , I am going to create CR memo request in VA01 without reference of Invoice . So ,in this case ,I have got one Issue as Z error .Please help me in this issue ,how to solve step be step . Note : 1. Actually , I am SD,MM and PS

  • Any way to get the Mail icon with changing number for incoming mail in ...

    Toolbar, the big one across the top of my screen. I have a lot of other handy little items in there, Mozy, Growl Plaxo, world clock, ical, in addition to the Mac stuff. If I could see how many mails I have up there, I wouldn't need to check my dock o

  • IPod touch 2nd generation - but which version of softwear? Where di I find this information?

    I need to find information about which version of softwear my iPod touch 2nd generation is running. Where do I find this information?

  • Custom Ringtone issue

    I know I saw a thread on this a few weeks ago, but I am unable to find it. When I sync custom ringtones to my iphone it always takes one of them and makes it the ring tone for all of the custom ones I have. For example I make ring tone one then sync

  • OSX Lion User Application folder missing.

    Trying to install an application soley for a user in OS X Lion. Although I don't have an "Applications" folder in my user folder. Did they take this option out of Lion or am I missing something here?