Question: I'm trying to delete some BlRelation in my database using hibernate. 

Unfortunately the query does not work. Could you please help me on this ? I know it should be quite straightforward ...

```
delete r FROM BlRelation where r.elementId.blProvider.providerId = 1

```

Thanks !

Answer: 
First, change your ViewController.h to

```
#import <UIKit/UIKit.h>

@class AVAudioPlayer;

@interface ViewController : UIViewController

-(IBAction)PlayRandomSound;
@property (nonatomic, retain) AVAudioPlayer *soundPlayer;

@end

```

and first lines of ViewController.m to

```
#import "ViewController.h"

#import <AVFoundation/AVAudioPlayer.h>

@implementation ViewController

@synthesize soundPlayer = _soundPlayer;

-(IBAction)PlayRandomSound{

    int randomNumber = arc4random() % 8 + 1;

    NSURL *soundURL = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:[NSString stringWithFormat:@"Sound%02d", randomNumber] ofType:@"mp3"]];

    _soundPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:nil];

    [_soundPlayer prepareToPlay];
    [_soundPlayer play];

    NSLog(@"randomNumber is %d", randomNumber);
    NSLog(@"tmpFilename is %@", soundURL);
}

```

Edit: i only later noticed that you don't use ARC so this code has a small leak. But it will do for start. Maybe you should set \_soundPlayer to nil when you create ViewController and later check: if it's not nil: release it and create new one, otherwise just create new one. Or you could consider switching to ARC if it's a new project.
For your filenames you should use

```
NSString *tmpFileNameRandom = [[NSString alloc] initWithFormat:@"Sound%02d", randomNumber];

```

this will give you leading zeros with numbers < 10...

or better yet, try this:

```
int randomNumber = arc4random() % 24 + 1;

NSURL *soundURL = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:[NSString stringWithFormat:@"Sound%02d", randomNumber] ofType:@"mp3"]];

AVAudioPlayer * soundPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:nil];

[soundPlayer prepareToPlay];
[soundPlayer play];

```