留言板

Liferay 7 Hibernate Sample

thumbnail
Gustavo Oliveira,修改在7 年前。

Liferay 7 Hibernate Sample

Junior Member 帖子: 98 加入日期: 15-9-23 最近的帖子
Hi, is there a sample of a portlet using Hibernate?? Im getting beaten up by lib conflicts.

OSGI or War. Any working example would help a lot. Thanks
thumbnail
David H Nebinger,修改在7 年前。

RE: Liferay 7 Hibernate Sample

Liferay Legend 帖子: 14914 加入日期: 06-9-2 最近的帖子
I'd avoid direct hibernate access; service builder gives you the same functionality but works well within the portal environment.
thumbnail
Gustavo Oliveira,修改在7 年前。

RE: Liferay 7 Hibernate Sample

Junior Member 帖子: 98 加入日期: 15-9-23 最近的帖子
David H Nebinger:
I'd avoid direct hibernate access; service builder gives you the same functionality but works well within the portal environment.


I tried using service builder with the last Developer Studio version, its not working. Everytime that I run Build Services I get a "Could not create IProject Builder". Ive tested in a new Eclipse workspace with a new Liferay Workspace, didnt change anything, tried to build the sample service.xml and the error still occurs.
thumbnail
David H Nebinger,修改在7 年前。

RE: Liferay 7 Hibernate Sample

Liferay Legend 帖子: 14914 加入日期: 06-9-2 最近的帖子
When all else fails, the gradle build process has no problems!

As an intellij user, I typically revert to the command line to run blade and gradle. The point here is that you shouldn't let the IDE choose what you do and how. The IDE is a tool to help you get things done, but it's not the only way.
thumbnail
Gustavo Oliveira,修改在7 年前。

RE: Liferay 7 Hibernate Sample

Junior Member 帖子: 98 加入日期: 15-9-23 最近的帖子
Indeed, it worked using only Gradle. Thanks emoticon

The only problem Im having now is when I deploy it. It disappears when I reference one of my services.

If I reference a Liferay Service it works, example:
	private CounterLocalService counterService;
	
	@Reference(unbind = "-")
	public void setCounterService(CounterLocalService counterService) {
		this.counterService = counterService;
	}


But when I add my service, it just disappers, doesnt show any error:

	@Reference(unbind = "-")
	public void setCounterService(CounterLocalService counterService) {
		this.counterService = counterService;
	}

	@Reference(unbind = "-")
	public void setTesteService(TesteLocalService testeService) {
		this.testeService = testeService;
	}


build.gradle:
	compileOnly project(":modules:testeServico:testeServico-api")


Am I missing something? All 3 modules are active on Gogo Shell, service, service-api and the view module.
thumbnail
Sampsa Sohlman,修改在7 年前。

RE: Liferay 7 Hibernate Sample

Regular Member 帖子: 230 加入日期: 07-9-27 最近的帖子
Just a side note, if you don't need setter when assigning service you can just use example:

@Reference
private CounterLocalService _counterService;