Question: I have one to many association in my dto,

Parent DTO : **Question**  

Child DTO : **History**

**Question 1:**

Means One question record has many history records, I am using JPA2.x with hibernate, 
I bound the entities with lazy fetching method/mode. some places I want the lazy fetching...
and some places I don't want the lazy fetching not even egar. Means I don't want the data collection itself. I need only the parent class list, even if I call getHistories() method, it should not do lazy fetch in few places.... How to use entityManager to avoid lazy fetching.....even though the collection was set to lazy fetch mode.....?

**Question 2:**

I need to encrypt the question using mysql encode/decode functions. when inserting encrypt the value and save. when selecting decode the content.....

Solution can be in mapping or criteria query...?

Thanks In Advance....!

Answer: 
Your code executes in the background window of your extension, the `window` object is the background window. To change tab location you need to execute code in the tab. You do it with the [`chrome.tabs.executeScript` method](http://code.google.com/chrome/extensions/tabs.html#method-executeScript). Something like this (untested):

```js
function callLocalhost(obj, tab){
    chrome.tabs.executeScript(tab.id, {
        code: "var obj = " + JSON.stringify(obj) + ";" +
              "window.location.href='http://localhost/'+obj.selectionText;"
    });
}

```

Note that the content script (the script injected into the tab) cannot access variables of the background window directly. This is why I put `obj` directly into the code to be executed in the tab.
Use the [chrome.tabs.create](http://code.google.com/chrome/extensions/tabs.html#method-create) API.