I have tried inserting a new record with ownerId and also with ownerName.But using "Ownername" shows the below error
Account acc=new Account(Name='nEW',OwnerId='00528000001IpTb');
insert acc;
Account acc1=new Account(Name='nEW',Account__r.owner.firstname='gSS');
insert acc;
Invalid field initializer: Account__r.owner.firstname
How can I use OwnerName instead of OwnerId?Or is there any work around?