我正在尝试将新的Google Maps Android API v2合并到使用Android支持库的应用程序中.我已经经历了很多迭代,试图到某个地方工作,现在我已经放弃了,我想我应该在这里问.
我转到API控制台,创建了一个项目,为Android启用了Google Maps API v2,根据需要创建了一个调试KEY并将其粘贴到清单上.没有身份验证问题或类似的事情.很确定我做对了.
在我的项目libs文件夹中,我放置android-support-v4.jar(通过项目右键单击 - > Android->添加支持库...).在Eclipse中,我将File-> Import-> Android-> Existing Android Code To Intospace导入并导入最新的(rev 3)android-sdk/google/google_play_services/libproject/google-play-services_lib.然后我将它作为依赖库添加到我的项目中(项目右键单击 - >属性 - > Android->将其添加为底部的库依赖项.
在我的清单中我有:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...>
<permission
android:name="myapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<All the uses-permission required like INTERNET, ACCESS_NETWORK_STATE, WRITE_EXTERNAL_STORAGE, FINE AND COARSE LOCATION, etc>
<uses-permission android:name="myapp.permission.MAPS_RECEIVE"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<application ...>
...
<uses-library android:name="com.google.android.maps" />
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AI..."/>
</application>
Run Code Online (Sandbox Code Playgroud)
在我的mainview.xml中,我有:
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
Run Code Online (Sandbox Code Playgroud)
现在在MainView.java上我有:
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; …Run Code Online (Sandbox Code Playgroud) android google-maps android-support-library google-play-services google-maps-android-api-2
我有两个型号.
@Entity
public class Student
{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
protected long id;
@?
protected Address homeAddress;
@?
protected Address schoolAddress;
}
@Entity
public class Address
{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
protected long id;
@?
protected List<Student> students;
}
Run Code Online (Sandbox Code Playgroud)
做什么JPA /休眠批注我需要把上面homeAddress,schoolAddress并且students使协会工作?
当然,我尝试了很多东西,没有任何效果.例如,设置
@ManyToOne
@JoinColumn (name="student_homeAddress_id", updatable = false, insertable = false)
protected Address homeAddress;
@ManyToOne
@JoinColumn (name="student_schoolAddress_id", updatable = false, insertable = false)
protected Address schoolAddress;
Run Code Online (Sandbox Code Playgroud)
和
@OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch = FetchType.EAGER)
@JoinColumns({
@JoinColumn(name = "student_homeAddress_id", referencedColumnName …Run Code Online (Sandbox Code Playgroud)