Fórum

Liferay 7 Hibernate Sample

thumbnail
Gustavo Oliveira, modificado 7 Anos atrás.

Liferay 7 Hibernate Sample

Junior Member Postagens: 98 Data de Entrada: 23/09/15 Postagens Recentes
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, modificado 7 Anos atrás.

RE: Liferay 7 Hibernate Sample

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
I'd avoid direct hibernate access; service builder gives you the same functionality but works well within the portal environment.
thumbnail
Gustavo Oliveira, modificado 7 Anos atrás.

RE: Liferay 7 Hibernate Sample

Junior Member Postagens: 98 Data de Entrada: 23/09/15 Postagens Recentes
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, modificado 7 Anos atrás.

RE: Liferay 7 Hibernate Sample

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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, modificado 7 Anos atrás.

RE: Liferay 7 Hibernate Sample

Junior Member Postagens: 98 Data de Entrada: 23/09/15 Postagens Recentes
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, modificado 7 Anos atrás.

RE: Liferay 7 Hibernate Sample

Regular Member Postagens: 230 Data de Entrada: 27/09/07 Postagens Recentes
Just a side note, if you don't need setter when assigning service you can just use example:

@Reference
private CounterLocalService _counterService;