Bears will pretty much attack anything unlucky enough to attract their curiosity. This is one of the simple truths about heading out into the wilderness and is something that everyone should be prepared to face and be equipped to deal with.
While hammocks themselves won’t attract the attention of a bear any more than a tent, it's usually other factors that contribute to drawing bears and their ire.
Usually, when people camp out they will cook their dinner at their campsite and the scent of food, along with the warmth a fire gives off can be enough to draw various predators and scavengers, bears among them.
While bears won’t be particularly offended to see you using a hammock instead of a tent, if they feel threatened they are liable to attack.
The best habits to get into are eating your food quickly and not leaving scraps out in the open to draw predators, being prepared with deterrents such as bear spray, and making yourself an unappealing target. Leaving as little trace of your presence as possible is the best way to attract any unwanted attention when out in the wild.